I have the following example code:
public class MainWindow extends JFrame implements ActionListener {
public MainWindow() {
JButton openButton = new JButton('Open');
openButton.addActionListener(this);
add(openButton);
}
public void actionPerformed(ActionEvent e) {
// Create and show a modal dialog.
JDialog dialog = new JDialog(this, true);
dialog.setVisible(true);
}
}
When I click the openButton
it calls actionPerformed(ActionEvent e)
on the event dispatch thread and dialog.setVisible(true)
blocks it.
But with more sophisticated frames I notice that they still update their UI from non user generated events such as a Timer action.
In any other case that I block the EDT my UI completely hangs, but when dialog.setVisible(true)
blocks the EDT the owner's UI continues to update.
So my question is how does this work?