home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Late Night VRML 2.0 with Java CD-ROM
/
code.zip
/
Ch12
/
ui
/
dialogs
/
GeneralWarnDialog.java
< prev
next >
Wrap
Text File
|
1997-01-04
|
2KB
|
90 lines
// VRML Generator
// (c) Justin Couch
//
// From Chapter 13: Late Night VRML 2.0 and Java
//
// Not Implemented Yet warning dialog.
package ui.dialogs;
import java.awt.*;
public class GeneralWarnDialog extends Dialog
{
Button button;
Label label;
public GeneralWarnDialog(Frame parent)
{
super(parent, "Warning", false);
setLayout(new BorderLayout(15, 15));
label = new Label("Warning: ");
add("Center", label);
// create the OK button in the middle of the dialog
button = new Button("OK");
Panel p = new Panel();
p.setLayout(new FlowLayout(FlowLayout.CENTER, 15, 15));
p.add(button);
add("South", p);
// resize to fit
pack();
}
public GeneralWarnDialog(Frame parent, String message)
{
super(parent, "Warning", false);
setLayout(new BorderLayout(15, 15));
label = new Label(message);
add("Center", label);
// create the OK button in the middle of the dialog
button = new Button("OK");
Panel p = new Panel();
p.setLayout(new FlowLayout(FlowLayout.CENTER, 15, 15));
p.add(button);
add("South", p);
// resize to fit
pack();
}
public void show(String message)
{
remove(label);
label = new Label(message);
add("Center", label);
// resize to fit
pack();
// now display it
this.show();
}
public boolean action(Event e, Object arg)
{
if(e.target == button)
{
hide();
return true;
}
else
return false;
}
public boolean getFocus(Event e, Object arg)
{
button.requestFocus();
return true;
}
}