I found a very annoying bug (bug radar id : 6987690) in menu bar
management of the last Java update:
A menu bar looses its menus when a dialog with an invisible parent is
closed. :-(
public class LostMenuBarTest {
public static void main(String [] args) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
final JFrame frame = new JFrame("LostMenuBarTest");
// Create a menu bar with a menu item that displays a dialog
final JMenuBar menuBar = new JMenuBar();
final AbstractAction menuAction = new AbstractAction("Menu") {
public void actionPerformed(ActionEvent e) {
}
};
JMenu menu = new JMenu(menuAction);
menuBar.add(menu);
menu.add(new AbstractAction("Empty menu bar") {
public void actionPerformed(ActionEvent ev) {
JOptionPane.showMessageDialog(null, "Once this message
dialog is closed, menu bar is empty");
}
});
// Display menu with frame
frame.setJMenuBar(menuBar);
frame.setBounds(0, 0, 500, 300);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
I know that it's always better to give a parent to showMessageDialog
but this used to work correctly, and sometimes you don't have any
window variable in the scope of the message.
Note that I experienced also the same bug with the undecorated visible
(but out of the screen) window of Sweet Home 3D used by default when
no document is opened (display Preferences and you'll see the same
problem).
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden