I am having a hard time to use the Swing worker to work with my project. It has two programs, one is the logic (full program) and the other is GUI. I am calling the logic program from the GUI. And because of its unresponsiveness, I tried using Swing worker. But even if I use Swing worker, its still unresponsive. If I run the program, it displays the GUI, but if I click on start, the another program starts and it becomes unresponsive.
This the snippet of GUI program (full program):
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
state.setText("Listening");
System.out.println("Started Listening");
state.setBackground(new Color(51, 204, 0));
doRun(args);
}
});
public void doRun(String[] args) {
SwingWorker<Void, String> worker = new SwingWorker<Void, String>(){
@Override
protected Void doInBackground() throws Exception {
// Object to use from another program
HelloWorld obj = new HelloWorld();
obj.main(args);
return null;
}};
worker.execute();
}