Swing GUI and Multithreading
Dear All,
I have gui, data starts flowing as soon as Connect button is press. Coz of
mulitthreading gui get freeze.
private class ConnectionThread
implements Runnable
{
public void run()
{
try
{
System.out.println("In ConnectionThread Run Method");
OiJsshEngine sshEngine = new OiJsshEngineImpl(getOptions());
OiJsshConnection sshConnection = sshEngine.getSSHConnection();
OiJsshStreamFilter filter = null;
filter = new OiJsshStreamFilterImpl("#");
filter.setUI(txtData);
filter.setPatternMatcherStream(System.err);
filter.setPatternMismatchStream(System.out);
OiJsshStreamWriterThread writerThread = new
OiJsshStreamWriterThread(sshConnection.getOutputStream());
writerThread.start();
sshConnection.execShell();
}
catch(Exception e)
{
System.out.println(e);
}
}
private void cmdConnectActionPerformed(ActionEvent evt)
{
cnn = new ConnectionThread();
Thread t = new Thread(cnn);
t.setDaemon(true);
SwingUtilities.invokeLater(t);
}
What alternative can i work on.
Thank in advance for the pointers.
Regards,
Ketan