home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Late Night VRML 2.0 with Java CD-ROM
/
code.zip
/
Ch12
/
ui
/
dialogs
/
ShapeDialog.java
< prev
next >
Wrap
Text File
|
1997-01-02
|
1KB
|
58 lines
// VRML Generator
// (c) Justin Couch
//
// From Chapter 13: Late Night VRML 2.0 and Java
//
// The container dialog for editing the properties of each node
// This should be subclassed to produce the desired dialog
package ui.dialogs;
import java.awt.*;
import ui.dialogs.VrmlBaseDialog;
import geometry.Shape;
import ui.VrmlTree;
import VrmlScene;
import VrmlTypes;
import exceptions.NoSelectedNodeException;
public class ShapeDialog extends VrmlBaseDialog
{
public ShapeDialog(Frame parent, VrmlTree tree, VrmlScene data)
{
super(parent, "Edit Shape Node");
vrml_data = data;
screen_data = tree;
pack();
}
// this class needs to be implemented by the derived class.
public boolean applyInformation()
{
String str;
Shape shape = new Shape(browser);
str = name.getText();
if(str.equals(""))
shape.name = null;
else
shape.name = new String(str);
try
{
vrml_data.addNode(VrmlTypes.Shape, shape);
}
catch (NoSelectedNodeException e)
{
// should do something like barf with a dialog box here.
}
return false;
}
}