I have a java swing App that connects to a remote Unix box using JSch.
The user needs to provide the ip of the unix box in a JTextBox in the Swing App and clicks a “LOGIN” button in the App.
I need to prompt the user to enter another ip if there is some problem with the connection.
For this I catch JSchExceptions and prompt the user to enter a valid ip again…. And then after the user enters another ip, I try to login again..
My Code is working fine till prompting the user to enter the ip again on getting a JSchException… But I am not able to trigger the ActionEvent again to initiate the login process again…
I used button.doClick(); on the LOGIN button, but the event is not trigerring again as excepted !!
i also tried to do this after seeing some examples online:
ActionEvent ae = new ActionEvent((Object)button, ActionEvent.ACTION_PERFORMED, "");
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ae);
Still not working !!!
What could be the problem ? How can I make the event trigger itself again ??
Thanks for any responses.
Maybe you forgot to reset the variables for next trial. It would be better if you post part of the code executed when the button is clicked.