?? dsextendrectanglestar.java
字號:
package drawsmart.itsv.swing;import drawsmart.itsv.basic.DSRectangleSpace;import java.awt.geom.Rectangle2D;import java.awt.Color;import drawsmart.itsv.framework.JDSDesktopface;import drawsmart.itsv.model.SetupDataModel;import java.awt.Shape;import java.awt.geom.GeneralPath;import java.awt.Rectangle;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class DSExtendRectangleStar extends DSRectangleSpace { private JDSDesktopface jDSDesktopface; public DSExtendRectangleStar(JDSDesktopface jDSDesktopface) { super(); this.jDSDesktopface=jDSDesktopface; } /** * 重寫克隆方法 * @return */ public Object cloneComponent() { DSExtendRectangleStar cloneObject = new DSExtendRectangleStar(jDSDesktopface); Rectangle2D rect2D=this.getFrame(); cloneObject.setFrame(rect2D); Color color=this.getFillColor(); cloneObject.setFillColor(color); color=this.getFrameColor(); cloneObject.setFrameColor(color); cloneObject.setTextInfo(this.getTextInfo()); //cloneObject.removeAssociatorAll(); //寫入隨即值 int id = jDSDesktopface.getRandom(); String sID = Integer.toString(id); jDSDesktopface.addSetupDataModel(new SetupDataModel(),sID); cloneObject.setComponentID(sID); return cloneObject; } /** * 完全克隆 * @return Object */ public Object cloneComponentFull() { DSExtendRectangleStar cloneObject=(DSExtendRectangleStar)this.clone(); return cloneObject; } /** * 獲得該組件的范圍 * @return Shape */ public Shape getShape() { GeneralPath p=new GeneralPath(GeneralPath.WIND_NON_ZERO); //p. Rectangle rectangle=this.getBounds(); double x=rectangle.getX(); double y=rectangle.getY(); double h=rectangle.getHeight(); double w=rectangle.getWidth(); double a=w/5; double y1=y+h/2; p.moveTo((float)x,(float)(y+h/2)); p.lineTo((float)(x+(2*a)),(float)(y1-a/2)); //2 p.lineTo((float)(x+w/2),(float)y); //3 p.lineTo((float)(x+(3*a)),(float)(y1-a/2)); //4 p.lineTo((float)(x+w),(float)(y+h/2)); //5 p.lineTo((float)(x+(3*a)),(float)(y1+a/2)); //6 p.lineTo((float)(x+w/2),(float)(y+h)); //7 p.lineTo((float)(x+(2*a)),(float)(y1+a/2)); //8 p.closePath(); return p; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -