?? clickme.java
字號:
//ClickMe.java
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class ClickMe extends Applet implements ActionListener{
//域聲明
private Button quit=new Button("Quit");
private Button click=new Button("Click here");
private TextField text=new TextField(20);
private boolean secondClick=false;
//方法聲明
public void init(){
setLayout(new FlowLayout());
add(quit);
add(click);
add(text);
quit.addActionListener(this);
click.addActionListener(this);
}
public void start (){
text.setText("Applet started!");
}
public void stop(){
text.setText("Applet stopped!");
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==quit)
text.setText("Can not quit applet!");
else if(e.getSource()==click){
if (secondClick)
text.setText("Not again!");
else
text.setText("Uh, it tickles!");
secondClick = !secondClick;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -