⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 code37_2.txt

📁 《计算机网络与因特网》(原书第4版) 作者:Douglas Comer博士 出版社:机械工业出版社 书中例子的代码
💻 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 + -