I have a JMenu, the top JMenuItem of this JMenu fires a JOptionPane.
After dismissing the JOptionPane and returning to the JMenu:
I click on the JMenu to activate it.
The Menu pops up as normal.
But when I hover over the menu it disappears instantly.
Reactivating it by hovering back over the JMenu returns the operation to
normal.
Only firing the JOptionPane causes this behaviour.
Any clues?
Something to do with the disposal and modal state of the JOptionPane?
> I have a JMenu, the top JMenuItem of this JMenu fires a JOptionPane.
> After dismissing the JOptionPane and returning to the JMenu:
[quoted text clipped - 10 lines]
>
> Something to do with the disposal and modal state of the JOptionPane?
This demonstrates the problem:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Test extends JFrame {
public Test() {
setDefaultCloseOperation(EXIT_ON_CLOSE);
JMenuBar menuBar = new JMenuBar();
JMenu menu;
JMenuItem item;
menu = new JMenu("Menu");
menuBar.add(menu);
item = new JMenuItem("Fire JOptionPane");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showConfirmDialog(null, "Dispose of this and try menu
again",
"Test", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
}
});
menu.add(item);
setJMenuBar(menuBar);
setSize(100,100);
setVisible(true);
}
public static void main(String[] args) {
new Test();
}
}
Andrew Thompson - 29 May 2004 16:33 GMT
>> But when I hover over the menu it disappears instantly.
The code you provided does not display that
behaviour using 1.2.2 under XP, but does
using 1.4.2
[ ..and no, I do not have any deep (or
meaningful) thoughts on a solution, just
thought I would mention some results. ]

Signature
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
> I have a JMenu, the top JMenuItem of this JMenu fires a JOptionPane.
> After dismissing the JOptionPane and returning to the JMenu:
[quoted text clipped - 10 lines]
>
> Something to do with the disposal and modal state of the JOptionPane?
I've just encountered the exact same problem myself (and CRAP, I
posted it to the wrong group - that'll get some howls).
I'm at a loss.
.ed
www.EdmundKirwan.com