Hi, I have a problem with a java gui and opening a document. My problem is the complete gui hangs until the document is open, but I already threaded the action...
I have this action listener:
this.EditButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
String path = (String)DocumentsTable.getValueAt(DocumentsTable.getSelectedRow(), 2);
openDocument(path);
System.out.println("foo");
}
});
the action which is performed just opens the given path
private void openDocument(final String path){
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try{
Desktop.getDesktop().open(new File(path));
}
catch(Exception e){
JOptionPane.showMessageDialog(null, "Das Dokument konnte nicht geöffnet werden...\n"+e.toString());
e.printStackTrace();
}
}
});
}
If I run my program I immediately see "foo" on console but the gui completly hangs up and the button is in pressed state... Does anyone have an idea what I did wrong? My other action listeners work the same and I don't have the problem there...