home *** CD-ROM | disk | FTP | other *** search
/ Late Night VRML 2.0 with Java CD-ROM / code.zip / Ch12 / ui / dialogs / AppearanceDialog.java < prev    next >
Text File  |  1997-01-02  |  1KB  |  55 lines

  1. // VRML Generator
  2. // (c) Justin Couch
  3. //
  4. // From Chapter 13: Late Night VRML 2.0 and Java
  5. //
  6. // The Appearance node dialog
  7.  
  8. package ui.dialogs;
  9.  
  10. import java.awt.*;
  11. import ui.dialogs.VrmlBaseDialog;
  12. import geometry.Appearance;
  13. import ui.VrmlTree;
  14. import VrmlScene;
  15. import VrmlTypes;
  16. import exceptions.NoSelectedNodeException;
  17.  
  18. public class AppearanceDialog extends VrmlBaseDialog
  19. {
  20.  
  21.     public AppearanceDialog(Frame parent, VrmlTree tree, VrmlScene data)
  22.     {
  23.         super(parent, "Edit Appearance Node");
  24.  
  25.         vrml_data = data;
  26.         screen_data = tree;
  27.         
  28.         pack();
  29.     }
  30.  
  31.     // this class needs to be implemented by the derived class.
  32.     public boolean applyInformation()
  33.     {
  34.         String str;
  35.         Appearance appearance = new Appearance(browser);
  36.  
  37.         str = name.getText();
  38.  
  39.         if(str.equals(""))
  40.             appearance.name = null;
  41.         else
  42.             appearance.name = new String(name.getText());
  43.  
  44.         try
  45.         {
  46.             vrml_data.addNode(VrmlTypes.Appearance, appearance);
  47.         }
  48.         catch (NoSelectedNodeException e)
  49.         {
  50.             System.out.println("No node selected");
  51.         }
  52.         return false;
  53.     }
  54. }
  55.