-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
beta
-
generic, x86
-
generic, windows_nt
Name: rmT116609 Date: 09/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)
This problem occurs when a JComboBox has a list that's drawn outside its parent
JFrame/JDialog. The parent window becomes deactivated while the mouse is pressed
over the list.
Problem 1 (serious): The parent window receives bogus WindowDeactivated and
WindowActivated events.
Problem 2 (cosmetic): The color of the parent window's title bar indicates
inactive window while the mouse is pressed.
To reproduce the problem, run the supplied code. Drop down the list and click
it. Then resize the window, so that the list fits inside it, and try again.
/******************************************************
* This program illustrates that clicking in the list of
* a JComboBox causes the parent window to be deactivated
*******************************************************/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ComboTester extends JFrame {
private final static int MAX_ITEMS_IN_COMBO = 10;
public ComboTester () {
super ("Combo Tester");
getContentPane().setLayout (new BorderLayout ());
getContentPane().add (createCombo(), BorderLayout.NORTH);
addWindowListener (new WindowAdapter () {
public void windowClosing (WindowEvent evt) {
System.exit (0);
}//end windowClosing
public void windowDeactivated (WindowEvent evt) {
// Print a stack trace every time frame gets deactivated
new Exception("\n\nWindow Deactivated").printStackTrace();
}//end windowClosing
});
pack();
}//end constructor
JComboBox createCombo () {
JComboBox combo = new JComboBox ();
combo.setEditable (false);
for (int i = 0; i < MAX_ITEMS_IN_COMBO; i++) {
combo.addItem ("Item " + i);
}//end for
return combo;
}//end createCombo
public static void main (String[] args) {
new ComboTester().setVisible (true);
}//end main
}//end class ComboTester
(Review ID: 109537)
======================================================================