?? loginapplet.java
字號:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class LoginApplet extends Applet implements ActionListener
{
Button b1;
TextField tf1,tf2;
public void init()
{
Label t1,t2,t3;
Choice c1;
setBackground(Color.white);
setLayout(new FlowLayout(FlowLayout.LEFT));
t1 = new Label("郵箱");
tf1 = new TextField("用戶名",10);
t2 = new Label("@");
t2.setFont(new Font("Dialog",0,18));
c1 = new Choice();
c1.addItem("263.net");
t3 = new Label("密碼");
tf2 = new TextField("********",10);
b1 = new Button("登錄");
b1.addActionListener(this); //為按鈕注冊事件監(jiān)聽程序
tf2.addActionListener(this); //為文本行注冊事件監(jiān)聽程序
add(t1);
add(tf1);
add(t2);
add(c1);
add(t3);
add(tf2);
add(b1);
}
public void actionPerformed(ActionEvent e)
{
if ((e.getSource()==b1) || (e.getSource()==tf2))
{} //單擊按鈕或文本行中按〈回車〉時
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -