📄 buttontocall02.java
字号:
//
// Program: Scene Switcher
//
// Description:
// Uses the EAI to change the value of all Switch nodes in a scene
// based upon a couple of buttons that the user can press.
//
// Author: Martin Reddy <reddy@ai.sri.com>
// Version: 1.0, 8 March 2001
//
// Compiled against the Cortona 3 EAI classes, corteai.zip
//
import java.awt.*;
import java.applet.*;
import vrml.external.Node;
import vrml.external.Browser;
import vrml.external.field.*;
public class ButtonToCall02 extends Applet {
Browser browser = null;
String button1 = "Message";
String button2 = "Close";
Client client;
FirstWindow first;
// create the two applet buttons and get the browser reference
public void start() {
setBackground(Color.white);
add(new Button(button1));
add(new Button(button2));
client = new Client("127.0.0.1");
client.hide();
browser = Browser.getBrowser(this);
}
// The button event handling routine
public boolean action(Event event, Object what) {
if (event.target instanceof Button && browser != null) {
Button b = (Button) event.target;
if (b.getLabel().equals(button1)) {
client.show();
client.runClient();
}
if (b.getLabel() == button2) {
client.hide();
}
}
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -