-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.1.6, 1.1.7, 1.2.0
-
generic, x86
-
generic, solaris_2.5.1, windows_95, windows_nt
Name: eyC74480 Date: 06/01/98
/*
A basic extension of the java.awt.Dialog class
*/
import java.awt.*;
public class InputDialog extends Dialog
{
public InputDialog(Frame parent, boolean modal)
{
// THIS CAUSES THE DIALOG TO NO LONGER RECEIVE MESSAGES PROPERLY
super(parent, true);
// THIS WORKS FINE
// super(parent, false);
// This code is automatically generated by Visual Cafe when you add
// components to the visual environment. It instantiates and initializes
// the components. To modify the code, only use code syntax that matches
// what Visual Cafe can generate, or Visual Cafe may be unable to back
// parse your Java file into its visual environment.
//{{INIT_CONTROLS
setLayout(null);
setSize(insets().left + insets().right + 430,insets().top + insets().bottom + 270);
textField1 = new java.awt.TextField();
textField1.setBounds(insets().left + 81,insets().top + 87,111,27);
add(textField1);
button1 = new java.awt.Button();
button1.setLabel("button");
button1.setBounds(insets().left + 213,insets().top + 165,81,48);
button1.setBackground(new Color(12632256));
add(button1);
setTitle("Input Dialog");
//}}
//{{REGISTER_LISTENERS
SymWindow aSymWindow = new SymWindow();
this.addWindowListener(aSymWindow);
SymAction lSymAction = new SymAction();
button1.addActionListener(lSymAction);
//}}
}
public void addNotify()
{
// Record the size of the window prior to calling parents addNotify.
Dimension d = getSize();
super.addNotify();
if (fComponentsAdjusted)
return;
// Adjust components according to the insets
setSize(insets().left + insets().right + d.width, insets().top + insets().bottom + d.height);
Component components[] = getComponents();
for (int i = 0; i < components.length; i++)
{
Point p = components[i].getLocation();
p.translate(insets().left, insets().top);
components[i].setLocation(p);
}
fComponentsAdjusted = true;
}
// Used for addNotify check.
boolean fComponentsAdjusted = false;
public InputDialog(Frame parent, String title, boolean modal)
{
this(parent, modal);
setTitle(title);
}
public synchronized void show()
{
Rectangle bounds = getParent().bounds();
Rectangle abounds = bounds();
move(bounds.x + (bounds.width - abounds.width)/ 2,
bounds.y + (bounds.height - abounds.height)/2);
super.show();
}
//{{DECLARE_CONTROLS
java.awt.TextField textField1;
java.awt.Button button1;
//}}
class SymWindow extends java.awt.event.WindowAdapter
{
public void windowClosing(java.awt.event.WindowEvent event)
{
Object object = event.getSource();
if (object == InputDialog.this)
Dialog1_WindowClosing(event);
}
}
void Dialog1_WindowClosing(java.awt.event.WindowEvent event)
{
hide();
}
class SymAction implements java.awt.event.ActionListener
{
public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == button1)
button1_Action(event);
}
}
void button1_Action(java.awt.event.ActionEvent event)
{
// to do: code goes here.
setVisible(false);
}
}
(Review ID: 29877)
======================================================================
- duplicates
-
JDK-4144746 Modal Dialog Don't receive events
- Closed
-
JDK-4150178 Using synchronized with show() causes hang after dimissing a modal dialog.
- Closed
-
JDK-4156644 Modal dialogs can deadlock if show() or setVisible(true) in synchronized block
- Closed