-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
1.1.4
-
sparc
-
solaris_2.5.1
Name: mf23781 Date: 11/21/97
When running under the Common Desktop Environment (CDE),
modal dialogs only block input to their parent frame, and
no other. (This is actually on the AIX CDE but it probably
happens on Solaris CDE as well).
Here is the testcase:
import java.awt.*;
import java.applet.Applet;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public synchronized class md extends Applet implements ActionListener
{
Dialog modalDialog;
Panel colorPanel;
public md(Frame f)
{
Button showButton = new Button("Show Modal Dialog");
Button redButton = new Button("Set panel color to red");
Button blueButton = new Button("Set panel color to blue");
Button dismissButton = new Button("Dismiss");
Panel buttonPanel = new Panel();
colorPanel = new Panel();
modalDialog = new Dialog(f, "Modal Dialog", true);
modalDialog.setLayout(new FlowLayout());
modalDialog.setSize(200, 200);
modalDialog.setBackground(Color.green);
dismissButton.setBackground(Color.yellow);
modalDialog.add(dismissButton);
setLayout(new BorderLayout());
showButton.setBackground(Color.yellow);
buttonPanel.add(showButton);
buttonPanel.add(redButton);
buttonPanel.add(blueButton);
colorPanel.setBackground(Color.yellow);
add("North", buttonPanel);
add("Center", colorPanel);
showButton.addActionListener(this);
redButton.addActionListener(this);
blueButton.addActionListener(this);
dismissButton.addActionListener(this);
}
public void actionPerformed(ActionEvent actionEvent)
{
if (actionEvent.getActionCommand() == "Show Modal Dialog")
{
modalDialog.setVisible(true);
return;
}
if (actionEvent.getActionCommand() == "Set panel color to red")
{
colorPanel.setBackground(Color.red);
return;
}
if (actionEvent.getActionCommand() == "Set panel color to blue")
{
colorPanel.setBackground(Color.blue);
return;
}
if (actionEvent.getActionCommand() == "Dismiss")
modalDialog.dispose();
}
public static void main(String astring[])
{
Frame f = new Frame("Modal Dialog Displayer");
Frame f2 = new Frame("Frame 2");
f2.add(new TextField(20));
f2.pack();
f2.show();
md m = new md(f2); // change to new md(f) to see the bug
f.add(m);
f.pack();
f.setSize(500, 300);
f.show();
}
}
Input is only blocked to frame f2, not f. Making the change
mentioned in the code reverses the behaviour.
======================================================================