home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Late Night VRML 2.0 with Java CD-ROM
/
code.zip
/
Ch12
/
ui
/
OutputWindow.java
< prev
next >
Wrap
Text File
|
1997-01-01
|
1KB
|
65 lines
// (c) Justin Couch
//
// From Chapter 13: Late Night VRML 2.0 and Java
//
// The text window that contains the print out of the VRML code
// Consists of a simple menu bar as well as the non editable text area
package ui;
import java.awt.*;
import java.io.*;
import ui.dialogs.NotImpDialog;
public class OutputWindow extends Frame
{
private NotImpDialog warn;
private TextArea text_area;
public OutputWindow()
{
// create warning dialog
warn = new NotImpDialog(this);
// first create the menubar
MenuBar menu_bar = new MenuBar();
Menu file_menu = new Menu("&File", false);
file_menu.add(new MenuItem("&Save"));
file_menu.addSeparator();
file_menu.add(new MenuItem("&Close"));
menu_bar.add(file_menu);
setMenuBar(menu_bar);
// now create the text area that will take the output.
setLayout(new BorderLayout());
text_area = new TextArea();
text_area.setEditable(false);
add("Center", text_area);
resize(600, 400);
}
// copy the given string to the Text area. Calls the setText method so
// it completely replaces the contents that are already there.
public void setContents(String contents)
{
text_area.setText(contents);
}
public boolean action(Event e, Object arg)
{
if(e.target instanceof MenuItem)
{
if("&Close".equals(arg))
hide();
else if("&Save".equals(arg))
warn.show();
return true;
}
return false;
}
}