cake.java

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

JAVA
27
字号
// Figure 9.18import javax.swing.JComponent;import java.awt.Graphics;public abstract class Cake extends JComponent  {	/**	post:	getX() == x   and   getY() == y	 *			and  getWidth() == w   and   getHeight() == h 	 */	public Cake( int x, int y, int w, int h)  {    	super();		setBounds(x, y, w, h);   }	/**	post:	a cake is drawn with lines for cutting into eighths  */	public void paint( Graphics g )   {		paintCake(g);		paintEighthCuts(g);		paintChildren(g);	}	/**	post:	the cake is drawn  */	protected abstract void paintCake( Graphics g );	/**	post:	the lines are drawn for cutting the cake into eighths */	protected abstract void paintEighthCuts( Graphics g );}

⌨️ 快捷键说明

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