Created
May 18, 2018 21:49
-
-
Save RustyKnight/1a85ff63d8cb16d197b8ea19ebf214ed to your computer and use it in GitHub Desktop.
Simple test of invoke and wait
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JFileChooser chooser = new JFileChooser(); | |
Thread t = new Thread(new Runnable() { | |
@Override | |
public void run() { | |
try { | |
SwingUtilities.invokeAndWait(new Runnable() { | |
@Override | |
public void run() { | |
chooser.showOpenDialog(null); | |
JOptionPane.showMessageDialog(null, "Bananas"); | |
} | |
}); | |
System.out.println("Bang"); | |
System.out.println(chooser.getSelectedFile()); | |
} catch (InterruptedException | InvocationTargetException ex) { | |
ex.printStackTrace(); | |
} | |
} | |
}); | |
t.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment