?? movetest4.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 MoveTest4 extends Applet implements EventOutObserver{ TextField XField=new TextField(10); TextField YField=new TextField(10); TextField ZField=new TextField(10); Browser theBrowser = null; EventInSFVec3f trans1=null; public void init() { XField.setEditable(false); YField.setEditable(false); ZField.setEditable(false); this.setLayout(new BorderLayout()); Panel p1=new Panel(); p1.setLayout(new GridBagLayout()); GridBagConstraints gbc=new GridBagConstraints(); gbc.fill=GridBagConstraints.BOTH; gbc.anchor=GridBagConstraints.CENTER; gbc.gridwidth=1; p1.add(new Label("替身位置"),gbc); p1.add(XField,gbc); p1.add(YField,gbc); p1.add(ZField,gbc); this.add(p1,BorderLayout.NORTH); while (true) { try { theBrowser=Browser.getBrowser(this); Node Locator=theBrowser.getNode("Locator"); EventOut OutLocator1=Locator.getEventOut("position_changed"); OutLocator1.advise(this,null); break; } catch (Exception e) { System.out.println("實例獲取失敗!"); try{ Thread.sleep(200); } catch(InterruptedException eX){ } } } } public void callback(EventOut event,double time,Object data){ float[] Posit = ( (EventOutSFVec3f) event).getValue(); XField.setText(new Float(Posit[0]).toString()); YField.setText(new Float(Posit[1]).toString()); ZField.setText(new Float(Posit[2]).toString()); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -