📄 code37_2.txt
字号:
import java.applet.*;import java.net.*;import java.awt.*;public class buttons extends Applet { public void init() { setBackground(Color.white); add(new Button("Ying")); add(new Button("Yang")); } public boolean action(Event e, Object arg) { if (((Button) e.target).getLabel() == "Ying") { try { getAppletContext().showDocument( new URL("http://www.netbook.cs.purdue.edu/cs363/lecture_notes/chap29/ying.html")); } catch (Exception ex) { // note: code to handle the exception goes here // } } else if (((Button) e.target).getLabel() == "Yang") { try { getAppletContext().showDocument( new URL("http://www.netbook.cs.purdue.edu/cs363/lecture_notes/chap29/yang.html")); } catch (Exception ex) { // note: code to handle the exception goes here // } } return true; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -