-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.3.0
-
x86
-
windows_nt
Name: skT88420 Date: 02/10/2000
java version "1.3.0rc1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)
If the action of a JMenuItem calls code that disbles the JMenu
on which the JMenuItem resides, the program hangs. This did not
happen under jdk 1.2.2.
Here's a short example; both of the menu items will hang (on one item,
I tried using the Swing invokeLater() utility; that hangs too).
import javax.swing.*;
import java.awt.event.*;
public class MenuBug {
public static void main(String[] args) {
JFrame f = new JFrame("Menu Bug");
JMenuBar menubar = new JMenuBar();
f.setJMenuBar(menubar);
final JMenu bug = new JMenu("Kill the Program");
menubar.add(bug);
JMenuItem item = new JMenuItem("Now");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
bug.setEnabled(false);
}
});
bug.add(item);
item = new JMenuItem("Later");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
bug.setEnabled(false);
}
});
}
});
bug.add(item);
f.setSize(100, 100);
f.setVisible(true);
}
}
(Review ID: 101048)
======================================================================
Name: skT45625 Date: 05/19/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
Run this program and press the TAB key, and it will hang. It appears as if the
FocusManager loops trying to find the next focusable component.
This may be the same problem that causes #4311608, but the test case is much
simpler.
=============================================================================
import java.awt.event.*;
import javax.swing.*;
/**
** Run this program, and press Tab. The program will hang (JDK 1.3)
*/
public class Hang {
public static void main( String[] args ) {
JFrame frame = new JFrame( "Press Tab to hang program" );
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu( "Empty" );
menuBar.add( menu );
frame.setJMenuBar( menuBar );
frame.setSize( 300, 200 );
frame.setLocation( 200, 200 );
frame.validate();
frame.show();
}
}
=============================================================================
(Review ID: 105128)
======================================================================
- duplicates
-
JDK-4290675 Focus Management Enhancements
- Closed