buttonframe.java
来自「Java程序设计(美) David D. Riley著 机械工业出版社 书籍配套」· Java 代码 · 共 23 行
JAVA
23 行
import javax.swing.*;import java.awt.event.*;public class ButtonFrame extends JFrame implements ActionListener { private Timer theTimer; /** post: theTimer == t */ public ButtonFrame(Timer t) { super(""); setBounds(100, 100, 200, 80); setVisible(true); setLayout(null); JButton btn = new JButton("Start Sunrise"); btn.setBounds(10, 10, 180, 30); btn.addActionListener(this); add(btn, 0); repaint(); theTimer = t; } public void actionPerformed( ActionEvent e ) { theTimer.start( ); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?