📄 main.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package arrow;import java.awt.Button;import java.awt.FlowLayout;import java.awt.Frame;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.MouseEvent;import java.awt.event.MouseListener;/** * * @author zhaolin */public class Main { public static void main(String[] args) { Frame f = new Frame(); f.setLayout(new FlowLayout()); final Button b1 = new Button("OK"); final Button b2 = new Button("EXIT"); ActionListener al = new ActionListener(){ public void actionPerformed(ActionEvent e) { Object obj = e.getSource(); Button b = (Button)obj; if(b == b1){ System.out.println("OK clicked"); }else if(b == b2){ System.out.println("EXIT clicked"); } } }; b1.addActionListener(al); b2.addActionListener(al); f.add(b1); f.add(b2); f.setSize(300, 260); f.setVisible(true); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -