⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 driver.java

📁 Java程序设计(美) David D. Riley著 机械工业出版社 书籍配套 代码
💻 JAVA
字号:
import java.awt.event.*;import javax.swing.*;/** Example of event delegation  (Figure 9.31) * Author: David Riley * Date: January, 2005  */public class Driver implements ActionListener {    private JFrame  window;	private JButton simpleButton;	/**	post:	window is created at (10, 10) with width and height of 200	 *			and  simpleButton is added to window 	 */	public Driver()  {		window = new JFrame("JButton Delegate");		window.setBounds(10, 10, 200, 200);		window.setVisible(true);		window.setLayout(null);		simpleButton = new JButton("Click Me");		simpleButton.setBounds(50, 80, 100, 40);		simpleButton.addActionListener( this );		window.add( simpleButton, 0 );		window.repaint();    }    	/**	post:	a CLICKED message has been output. */    public  void  actionPerformed( ActionEvent e )   {		System.out.println( "CLICKED" );	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -