📄 11c.txt
字号:
package hello;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.rmi.Naming;
import java.rmi.RemoteException;
public class HelloApplet extends Applet {
boolean isStandalone = false;
String message = "blank";
//"obj" is the identifier that we'll use to refer
//to the remote object that implements the "Hello"
//interface
Hello obj = null;
/**Get a parameter value*/
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
/**Construct the applet*/
public HelloApplet() {
}
/**Initialize the applet*/
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
/**Component initialization*/
private void jbInit() throws Exception {
obj = (Hello)Naming.lookup("//" + getCodeBase().getHost()
+ "/HelloServer");
message = obj.sayHello();
}
public void paint(Graphics g){
g.drawString(message, 25, 50);
}
/**Get Applet information*/
public String getAppletInfo() {
return "Applet Information";
}
/**Get parameter info*/
public String[][] getParameterInfo() {
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -