movecubebutton.java
来自「Java程序设计(美) David D. Riley著 机械工业出版社 书籍配套」· Java 代码 · 共 26 行
JAVA
26 行
// Figure 8.30import java.awt.event.ActionEvent; public class MoveCubeButton extends EventButton { private Cube theCube; /** pre: d != null <br> * post: theCube == d * and getX() == x and getY() == y * and getWidth() == 100 and getHeight() == 30 */ public MoveCubeButton( int x, int y, Cube d ) { super( "MOVE" ); setBounds(x, y, 100, 30); theCube = d; } /** pre: theCube != null <br> * post: theCube.getX() == theCube.getX()@pre + 5 * and theCube.getY() = theCube.getY()@pre + 5 */ public void actionPerformed( ActionEvent e ) { theCube.setLocation( theCube.getX()+5, theCube.getY()+5 ); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?