📄 testiv.java
字号:
import java.util.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class TestIV extends Applet implements ActionListener
{
/**
* @param args
*/
private Button quit = new Button("Quit");
private Button click = new Button("Click here");
private TextField text = new TextField(10);
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 applets");
else if (e.getSource() == click)
{
if (secondClick)
text.setText("first click");
else
text.setText("second click, ahha,");
secondClick = !secondClick;
}
}
//public static void main(String[] args)
//{
// TODO Auto-generated method stub
//}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -