-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
x86
-
windows_nt
Name: mc57594 Date: 01/12/2000
Verified on Solaris 2.7 with jdk1.2.2.
Tested with java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-R)
Java HotSpot(TM) Client VM (build 1.3-R, interpreted mode)
Behavior is better with Kestrel (1.3), but after trying several times,
the problem shows up again.
[chamness]
======================
java version "1.2.2"
HotSpot VM (1.0.1, mixed mode, build g)
When a Window is set not visible with a contained JComboBox popup showing, the
popup is locked in place. When the Window is subsequently set visible the popup
is locked in its orginal place and cannot be removed. The following sample code
displays a JFrame with a single button. Press the button and a JDialog with
several JCombos is displayed. Open a combo popup and close the JDialog. Now
press the "Show Dialog" button again and the popup is locked in place.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ComboTestFrame extends JFrame implements ActionListener {
JDialog dialog;
JButton btn = new JButton("Show Dialog");
public ComboTestFrame() {
dialog = new JDialog(this, true);
dialog.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dialog.setVisible(false);
}
});
Container fContent = this.getContentPane();
fContent.setLayout(new BorderLayout());
fContent.add(btn, BorderLayout.CENTER);
btn.addActionListener(this);
Container dContent = dialog.getContentPane();
dContent.setLayout(new GridLayout(3,3,5,3));
dContent.add(new JComboBox(new String[] {"1a", "1b"}));
dContent.add(new JComboBox(new String[] {"1c", "1d"}));
dContent.add(new JComboBox(new String[] {"1e", "1f"}));
dContent.add(new JComboBox(new String[] {"2a", "2b"}));
dContent.add(new JComboBox(new String[] {"2c", "2d"}));
dContent.add(new JComboBox(new String[] {"2e", "2f"}));
dContent.add(new JComboBox(new String[] {"3a", "3b"}));
dContent.add(new JComboBox(new String[] {"3c", "3d"}));
dContent.add(new JComboBox(new String[] {"3e", "3f"}));
dialog.pack();
}
public void actionPerformed(ActionEvent e) {
dialog.setVisible(true);
}
public static void main(String[] args) {
ComboTestFrame f = new ComboTestFrame();
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
f.pack();
f.setVisible(true);
}
}
(Review ID: 99756)
======================================================================
- duplicates
-
JDK-4257858 If JComboBox is open when closing the window, it stays open next time.
-
- Resolved
-