-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
2.0_beta21, 1.1.6
-
generic, sparc
-
generic, solaris_7
Name: el35337 Date: 05/29/98
The example below has a JDesktopPane containing
a JInternalFrame. When you click the mouse
in the JInternalFrame, a popup menu comes up.
This menu contains another menu which contains
another. If you expand the menus all the way
out, then move the mouse off of the the menus
and click in the empty area of the desktop pane,
some of the popup menus do not disappear and
some do. This has been tested on NT 4.0 and
Solaris 2.5.1. I disabled lightweight popups
for all menus so they would not clip to the
internal frame.
This looks totally amateurish and NEEDS to be
fixed.
---------------------------------------
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
public class Test extends JFrame
{
private JPopupMenu mMenu;
public Test()
{
super();
setBounds( 100, 100, 400, 400 );
JDesktopPane desktop = new JDesktopPane();
getContentPane().add( "Center", desktop );
JInternalFrame f1 = new JInternalFrame( "F1" );
f1.getContentPane().addMouseListener( new MouseWatcher() );
f1.setBounds( 0, 0, 150, 300 );
desktop.add( f1 );
mMenu = new JPopupMenu();
JMenu menu2 = new JMenu( "Second menu" );
JMenuItem item0 = new JMenuItem( "Item 0" );
JMenu menu3 = new JMenu( "Third menu" );
JMenuItem item3 = new JMenuItem( "Item 3" );
JMenuItem item1 = new JMenuItem( "Item 1" );
JMenuItem item2 = new JMenuItem( "Item 2" );
mMenu.add( menu2 );
mMenu.add( item0 );
menu2.add( menu3 );
menu2.add( item1 );
menu3.add( item2 );
mMenu.setLightWeightPopupEnabled( false );
menu2.getPopupMenu().setLightWeightPopupEnabled( false );
menu3.getPopupMenu().setLightWeightPopupEnabled( false );
setVisible( true );
}
private class MouseWatcher extends MouseAdapter
{
public void mouseReleased( MouseEvent e )
{
mMenu.show( (Component)e.getSource(), e.getX(), e.getY() );
}
}
public static void main( String args[] )
{
new Test();
}
}
(Review ID: 32468)
======================================================================