📄 appletexample.java
字号:
/*
* AppletExample.java
*
* Created on 2004年9月19日, 上午9:16
*/
/**
*
* @author litertiger
*/
import java.awt.event.*;
import java.awt.*;
public class AppletExample extends java.applet.Applet implements ActionListener{
Button button1,button2;
int sum;
/** Initialization method that will be called after the applet is loaded
* into the browser.
*/
public void init() {
button1=new Button("是");
button2=new Button("否");
add(button1);
add(button2);
// TODO start asynchronous download of heavy resources
}
public void start()
{
sum=0;
for(int i=1;i<10;i++)
{
sum=sum+i;
}
}
public void paint(Graphics g)
{
g.setColor(Color.red);
g.drawString("程序设计方法", 30,26);
g.setColor(Color.BLACK);
g.drawString("sum= "+sum,200, 100);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==button1)
System.out.print("你该崔出");
destroy();
}
// TODO overwrite start(), stop() and destroy() methods
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -