?? app16_1.java
字號:
// app16_1, 簡單的事件處理范例(已加入事件處理)
import java.awt.*;
import java.awt.event.*;
class app16_1 extends Frame implements ActionListener
{
static app16_1 frm=new app16_1();
static Button btn=new Button("Click Me");
public static void main(String args[])
{
btn.addActionListener(frm); // 把frm向btn爹注冊
frm.setLayout(new FlowLayout());
frm.setTitle("Action Event");
frm.setSize(200,150);
frm.add(btn);
frm.setVisible(true);
}
public void actionPerformed(ActionEvent e) // 事件發生的處理操作
{
frm.setBackground(Color.yellow);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -