以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 SVG/GML/VRML/X3D/XAML 』  (http://bbs.xml.org.cn/list.asp?boardid=21)
----  vrml 与java连接运行不起来,帮忙看看  (http://bbs.xml.org.cn/dispbbs.asp?boardid=21&rootid=&id=73045)


--  作者:cleverwz
--  发布时间:3/15/2009 7:46:00 PM

--  vrml 与java连接运行不起来,帮忙看看
vrml 代码
Viewpoint
{
        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.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        print Script
{
        url        "print.class"
        eventIn        SFBool clicked
        eventIn        SFBool clicked2
        field SFString sceneEnt "Sphere"
}
ROUTE touch1.isActive TO print.clicked
ROUTE touch2.isActive TO print.clicked2

java代码:
import vrml.*;
import vrml.field.*;
import vrml.node.*;
public class print extends Script

{
        public void processEvent(Event e)
        {
                ConstSFBool v=(ConstSFBool)e.getValue();
                if(v.getValue())
                {
                        System.out.println("you clicked aball");
                        
                        if(e.getName().equals("clicked")==true)
                        {
                                System.out.println("red");
                                
                        }
                        else
                        {
                                System.out.println("green");
                        }
                        
                }
        }
}
在dos 中编译print.java 时出现错误,无法访问 Script  
  错误的类文件 .\script.class
类文件包含错误的类: vrml.node.script
......
public class print extends(这里出现提示) Script
不知道是哪出问题了,也把vrml的包放进去了,弄了很长时间,帮忙指导一下。谢谢
我是用vrmlpad编号vrml代码后,它里面有调试,进入运行的,(或直接按f8直接运行),是ParallelGraphics公司的VRML浏览器Cortona ,仅出现vrml模型,还有B用S Contact VRML,打开后也不行


--  作者:wangxiaotaolhc
--  发布时间:10/23/2010 9:37:00 AM

--  
你可能是包没有安装对吧,你的程序我运行了一下都好着的,我是刚刚学习vrml的,多多交流啊

--  作者:wangxiaotaolhc
--  发布时间:10/23/2010 9:44:00 AM

--  
我也有个问题啊,就是程序都运行了,java也通过编译了,但是在点击小球的时候没有发生触发事件这是什么原因是哪个地方的问题?
--  作者:ftstiger
--  发布时间:4/1/2011 9:06:00 AM

--  
我也有与楼上同样的问题啊,就是程序都运行了,java也通过编译了,但是在点击小球的时候没有发生触发事件这是什么原因是哪个地方的问题?
提示Java support for Script node not implemented.
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
62.500ms