📄 freehandapplet.java~4~
字号:
package chapter11;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.JToggleButton;
import javax.swing.JLabel;
public class FreeHandApplet
extends Applet
{
boolean isStandalone = false;
BorderLayout borderLayout1 = new BorderLayout();
String var0;
String var1;
JLabel jLabel1 = new JLabel();
//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 FreeHandApplet()
{
}
//Initialize the applet
public void init()
{
try
{
var0 = this.getParameter("param0", "");
}
catch (Exception e)
{
e.printStackTrace();
}
try
{
var1 = this.getParameter("param1", "");
}
catch (Exception e)
{
e.printStackTrace();
}
try
{
jbInit();
}
catch (Exception e)
{
e.printStackTrace();
}
}
//Component initialization
private void jbInit()
throws Exception
{
jLabel1.setText("jLabel1");
this.add(jLabel1);
}
//Start the applet
public void start()
{
}
//Stop the applet
public void stop()
{
}
//Destroy the applet
public void destroy()
{
}
//Get Applet information
public String getAppletInfo()
{
return "Applet Information";
}
//Get parameter info
public String[][] getParameterInfo()
{
java.lang.String[][] pinfo =
{
{
"param0", "String", ""},
{
"param1", "String", ""},
};
return pinfo;
}
//Main method
public static void main(String[] args)
{
FreeHandApplet applet = new FreeHandApplet();
applet.isStandalone = true;
Frame frame;
frame = new Frame();
frame.setTitle("Applet Frame");
frame.add(applet, BorderLayout.CENTER);
applet.init();
applet.start();
frame.setSize(400, 320);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation( (d.width - frame.getSize().width) / 2,
(d.height - frame.getSize().height) / 2);
frame.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -