?? 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 + -