-
Bug
-
Resolution: Fixed
-
P4
-
1.2.2
-
beta
-
generic
-
generic
Name: skT88420 Date: 09/16/99
The problem is that when the JPopupMenu is visible, if an event
disabled the JMenu that has popuped the JPopupMenu. This one will
not be closed when releasing the mouse !
The problem appears with any JDK/Swing version (1.1.8/swing 1.1.1 or 1.2.2 or 1.3)
Here is a an example. To reproduce :
1- Launch the sample
2- Choose "File"
3- Choose "Select This Sub Menu"
4- During the time the sub menu is open, click on the label
in the main window (this will disable the Select This Sub Menu item)
5- The popup IS NOT closed !
To repeat you need to relaunch the sample
////
import java.awt.event.*;
import javax.swing.*;
public class PopupProblem extends JFrame
{
// PopupProblem CJO 09/99
public static void main(String[] arg)
{
new PopupProblem();
}
public PopupProblem()
{
super("Popup Pb");
JMenuBar bar = new JMenuBar();
JMenu file = new JMenu("File");
file.add("...");
file.add("...");
file.add("...");
final JMenu sub = new JMenu("Select This Sub Menu");
file.add(sub);
sub.add("---");
sub.add("---");
sub.add("---");
bar.add(file);
setJMenuBar(bar);
JLabel label = new JLabel("Click on this part when the sub menu is opened");
label.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
sub.setEnabled(false);
}
});
getContentPane().add(label);
setSize(640, 400);
setVisible(true);
}
}
(Review ID: 95328)
======================================================================