【Java开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了Java开源代码-CakeButton.java的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
// Figure 9.13
import java.awt.event.ActionEvent;
public class CakeButton extends EventButton {
private Driver driver;
/** pre: d != null <br>
* post: getX() == x and getY() == y
* and getWidth() == 250 and getHeight() == 30
* and getText() == "make and slice a new cake"
* and driver == d
*/
public CakeButton( int x, int y, Driver d) {
super("make and slice a new cake");
setBounds(x, y, 250, 30);
driver = d;
}
/** pre: driver != null <br>
* note: the cutTheCake method from driver is performed.
*/
public void actionPerformed( ActionEvent e ) {
driver.cutTheCake( );
}
}
上一篇:
Cake.java
下一篇:
经济酒店发展:China''s economy hotel market development strategies