?? movetest6.java
字號:
import java.applet.Applet;import java.awt.*;import java.awt.event.*;import java.applet.*;import vrml.external.*;import vrml.external.field.*;import vrml.external.exception.*;public class MoveTest6 extends Applet implements EventOutObserver{ Browser theBrowser = null; float[] Posit = {0, 0, 0}; boolean Active=false; float[] hitPoin=new float[3]; public void init() { try { theBrowser = Browser.getBrowser(this); Node Locator = theBrowser.getNode("Tch1"); EventOut OutLocator1 = Locator.getEventOut("hitPoint_changed"); OutLocator1.advise(this, "hitPoint"); EventOut OutLocator2 = Locator.getEventOut("isActive_changed"); OutLocator2.advise(this, "isActive"); } catch (Exception e) { System.out.println("實例獲取失敗!"); try { Thread.sleep(200); } catch (InterruptedException eX) { } } } public void callback(EventOut event, double time, Object data) { if (data.toString()=="isActive") { Active=( (EventOutSFBool) event).getValue(); } if ((data.toString()=="hitPoint")&&Active){ Node Obj1 = theBrowser.getNode("Obj1"); EventInSFVec3f trans1 = (EventInSFVec3f) Obj1.getEventIn( "set_translation"); hitPoin = ( (EventOutSFVec3f) event).getValue(); trans1.setValue(hitPoin); } }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -