heightfield.java

来自「Java程序设计(美) David D. Riley著 机械工业出版社 书籍配套」· Java 代码 · 共 26 行

JAVA
26
字号
import javax.swing.JTextField;import java.awt.event.*;public class HeightField extends JTextField implements ActionListener {	private Driver driver;	/**	pre:	d != null  <br>	 *	post:	driver == d	 *			and  getX() == x   and   getY() == y	 *			and   getWidth() == 60   and   getHeight() == 25 	 */    public HeightField( int x, int y, Driver d )  {    	  	super();			setBounds(x, y, 60, 25);			addActionListener(this);        	driver = d;    }	/**	pre:	driver != null  <br>	 *	post:   the displayFall method from driver is performed	 *			upon the integer value of this.	 */	public void actionPerformed( ActionEvent e )   {        driver.displayFall( (new Integer(getText())).intValue() );	}}

⌨️ 快捷键说明

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