OptionPaneUI does not connect event handlers properly
warownia1 opened this issue · comments
Dialogs (and internal frame dialogs) created by the JOptionPane do not react to the button presses. It is likely the issue of OptionPaneUI not triggering JOptionPane's property change listeners on button clicks.
Example code:
public class DialogsTest extends JFrame
{
DialogsTest() {
super();
setDefaultCloseOperation(EXIT_ON_CLOSE);
setBounds(0, 0, 800, 600);
setVisible(true);
setContentPane(new JDesktopPane());
var pane = new JOptionPane("I'm a banana");
var dialog = pane.createDialog(getContentPane(), "Hello!");
dialog.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(DialogsTest::new);
}
}
Clicking OK button closes the dialog in java, but does nothing in javascript.
not seeing this. perhaps fixed at some point. Note that using this motif, JavaScript does not wait. You would need to subclass JDesktopPane to implement PropertyChangeListener and look for the "value" property being passed to it. The standard
JOptionPane.showMessageDialog(this, "I'm a Banana");
works as expected.