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

📄 downtriangle.java

📁 Java程序设计(美) David D. Riley著 机械工业出版社 书籍配套 代码
💻 JAVA
字号:
// Figure 14.21import javax.swing.JComponent;import java.awt.*;public class DownTriangle extends JComponent  {	/**	post:	getX() == x-h/2  and  getY() == y+h/2	 *          and getWdith()==h/2  and  getHeight()==h/2 	 */	public DownTriangle(int x, int y, int h )   {		super();		setBounds(x-h/4, y+h/2, h/2, h/2);	}		/**	post:	a black triangle is drawn with vertices at upper	 *          left, upper right and center bottom of the 	 *          bounding rectangle 	 */	public void paint(Graphics g)   {		g.setColor(Color.black);		g.drawLine(0, 0, getWidth()-1, 0);		g.drawLine(0, 0, getWidth()/2, getHeight()-1);		g.drawLine(getHeight()-1, 0, getWidth()/2, getHeight()-1);	}}

⌨️ 快捷键说明

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