-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.1
-
x86
-
windows_2000
Name: rmT116609 Date: 03/19/2003
FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
JOptionPane hangs when instantiated multiple times quickly.
i.e. Open, make selection, Close, Open, make selection, Close....
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a frame with a button in it.
Add an action listener on the button that creates a JOptionPane asking for yes/no input (doesn't really matter).
Click on the button to popup the option pane.
Press space to close option pane( default button ).
Press space to open option pane ( now default button of form is selected ).
Repeat quickly.
Bug shows itself best if you have some sort of cpu time consuming process between each optionPane instantiation. This is simulated by a thread.wait in the example code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
The option pane closes and opens fine.
JOption pane eventually hangs, not redrawing its contents. And not allowing itself to be closed.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package OptionPaneBug;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Application
{
Frame frame;
//Construct the application
public Application()
{
frame = new Frame();
frame.setSize(100,100);
JButton button = new JButton("Click me");
frame.add( button );
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JOptionPane.showConfirmDialog(frame,"Hello");
try
{
// simulate a fair amount of internal processing.
Thread.sleep(200);
}
catch( Exception ex )
{
ex.printStackTrace();
}
}
});
frame.setVisible(true);
}
//Main method
public static void main(String[] args)
{
new Application();
}
}
---------- END SOURCE ----------
(Review ID: 182816)
======================================================================
- duplicates
-
JDK-4531693 Deadlock while showing a modal dialog from inkoveAndWait().
-
- Resolved
-