如何在vrml里弹出窗口
我照着《VRML与Java编程技术》,写了这样的一个程序,但是没效果出来请高手们指教啊!!!vrml文件:#VRML V2.0 utf8Viewpoint
{
 position 0 0 15
 orientation 0 0 1 0
 fieldOfView 0.8
}Background
{
 skyColor [ 0 0 0.2,
       0.1 0.1 0.8,
       0.7 0.8 0.9
      ]
 skyAngle [1 1.57]
 groundColor [ 0.0 0.0 0.0,
        0.5 0.4 0.3,
        0.3 0.3 0.3
       ]
 groundAngle [1 1.57]
}DEF ball1 Transform
{
 translation -3 0 0
 children
 [
   DEF Touch1 TouchSensor{}
   Shape
   {
    appearance Appearance
    {
      material DEF SphereColor Material
      {
       diffuseColor 1 0 0
      }
    }
     geometry Sphere{}
   }
 ]
}DEF ball2 Transform
{
 translation 3 0 0
 children
 [
   DEF Touch2 TouchSensor{}
   Shape
   {
    appearance Appearance
    {
      material DEF SphereColor2 Material
      {
       diffuseColor 0 1 0
      }
    }
     geometry Sphere{}
   }
 ]
}DEF openWnd Script
{
 url"layOut.class"
 eventIn SFBool clicked
 eventIn SFBool clicked2
}
ROUTE Touch1.isActive TO openWnd.clicked
ROUTE Touch2.isActive TO openWnd.clicked2   Java窗体程序:import java.awt.*;
import javax.swing.*;public class TheFirstWindow extends Frame{
 
 public static void main(String args[]){
  TheFirstWindow opp = new TheFirstWindow();
  opp.show();
  opp.resize(500,400);
  opp.setTitle("我的窗口");
 }
 
 public TheFirstWindow(){
  Label labely = new Label("欢迎进入我的第一个窗口",Label.LEFT);
  add(labely);
  Panel pp = new Panel();
  pp.add(new Button("打开"));
  pp.add(new Button("关闭"));
  pp.add(new Button("更多内容"));
  pp.setBackground(Color.red);
  add(pp);
  Panel p = new Panel();
  p.add(new TextArea("",6,25));
  p.add(new Button("保存"));
  p.add(new Button("我要留言"));
  p.add(new Button("全部删除"));
  p.setBackground(Color.green);
  setLayout(new FlowLayout());
  add(p);
 }
 
 public boolean handleEvent(Event e){
  TextField t = new TextField();
  switch(e.id){
   case Event.WINDOW_DESTROY:
    dispose();
    System.exit(0);
    default:
     return super.handleEvent(e);
  }
 }}   与vrml通信的程序:import vrml.*;
import vrml.field.*;
import vrml.node.*;
public class layOut extends Script{
 
 TheFirstWindow myWindow;
 
 public void initialize()
 {
   myWindow = new TheFirstWindow();
 }
 
 public void processEvent(Event e)
 {
  ConstSFBool v = (ConstSFBool)e.getValue();
  if(v.getValue())
  {
   if(e.getName().equals("clicked") == true)
   {
    myWindow.show();
   }
   else
   {
    myWindow.hide();
   }
  }
 }
}