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

📄 driver.java

📁 Java程序设计(美) David D. Riley著 机械工业出版社 书籍配套 代码
💻 JAVA
字号:
import java.awt.*;/**	Author: David D. Riley *		Date: Jan, 2005 *   Program to illustrate events in recoloring a square (Figure 4.25) */	public class Driver extends ThreeButtons {	private ThreeButtonFrame  window;	private Rectangle square;	/** post:	a window with a 100 by 100 filled black square is drawn     *			and button actions control recoloring of the square       */	public Driver()   {		window = new ThreeButtonFrame("Square Recoloring Window");		window.setLayout(null);		square = new Rectangle(250, 150, 100, 100);		window.add(square, 0);		square.repaint();	}		/**	pre:	square is constructed		 *	post:	square is colored green  and  square is repainted   	 */	public  void  leftAction()   {		square.setBackground( Color.green );		square.repaint();	}	/**	pre:	square is constructed	     *	post:	square is colored red  and  square is repainted        */	public  void  midAction()   {		square.setBackground( Color.red );		square.repaint();	} 	/** 	pre:	square is constructed		 *	post:	square is colored blue  and  square is repainted   	 */	public  void  rightAction()   {		square.setBackground( Color.blue );		square.repaint();	}}

⌨️ 快捷键说明

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