-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.1.5
-
x86
-
windows_95
Name: rk38400 Date: 04/08/98
Create and display a modal JDialog from a parent
JFrame. Exiting the dialog causes the parent JFrame
to go blank or incorrectly repaint the parent. (In
the example code below it causes the first button to
appear twice sometimes after closing the dialog).
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
class bug extends JFrame implements ActionListener
{
JButton btnDialog = new JButton("Show Dialog");
JDialog dialog = new JDialog(this, true);
JButton btnClose = new JButton("Close");
public static void main(String[] args)
{
bug myBug = new bug();
}
bug()
{
setTitle("Mr Modal Bug");
setSize(300,300);
getContentPane().setLayout(new FlowLayout());
getContentPane().add(btnDialog);
getContentPane().add(new JButton("dummy1"));
getContentPane().add(new JButton("dummy2"));
getContentPane().add(new JButton("dummy3"));
getContentPane().add(new JButton("dummy4"));
getContentPane().add(new JButton("dummy5"));
dialog.setSize(300,300);
dialog.getContentPane().add(btnClose);
btnDialog.addActionListener(this);
btnClose.addActionListener(this);
setVisible(true);
}
public void actionPerformed(ActionEvent evt)
{
if (evt.getSource() == btnDialog)
dialog.setVisible(true);
else if (evt.getSource() == btnClose)
dialog.setVisible(false);
}
}
(Review ID: 25859)
======================================================================
- duplicates
-
JDK-4122683 hiding modal Dialog on NT can deadlock, freezing GUI
- Closed