-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0, 1.3.0
-
beta
-
x86
-
windows_nt
Name: skT88420 Date: 07/28/99
If one closes the window with with upper right corner X-button
when JComboBox is open, it stays open when the same window
is shown again. JComboBox cannot be closed after that, so
it hides other components.
Problem occurs, if windowClosing makes setVisible(false).
For example we have dispatched all windowClosings to
cancelButton event handlers for checkings etc., and
there we close the window with setVisible(false).
Example program:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Combo
{
private static JDialog m_dialog;
private static class DialogClose
extends WindowAdapter
{
public void windowClosing(WindowEvent event)
{ // this leaves the comboBox open
// also when showing window again
m_dialog.setVisible(false);
}
}
public static final void main(String[] args)
{
// Create a dialog with one JComboBox
m_dialog = new JDialog();
m_dialog.setSize(100, 100);
JComboBox combo = new JComboBox();
combo.addItem("test item 1");
combo.addItem("test item 2");
m_dialog.getContentPane().setLayout(new FlowLayout());
m_dialog.getContentPane().add(combo);
m_dialog.addWindowListener(new Combo.DialogClose());
// Create a frame for showing the dialog
JFrame frame = new JFrame();
JButton openButton = new JButton("Open");
openButton.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
m_dialog.setVisible(true);
}
}
);
frame.getContentPane().setLayout(new FlowLayout());
frame.getContentPane().add(openButton);
frame.addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEvent event)
{
System.exit(0);
}
});
frame.setSize(100, 100);
frame.setVisible(true);
}
}
java version "1.2"
HotSpot VM (1.0fcs, mixed mode, build E)
java full version "JDK-1.2-V"
(Review ID: 93142)
======================================================================
- duplicates
-
JDK-4304275 JComboBox popup locked when containing Window set not visible
-
- Closed
-