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

📄 dsextendrectanglestar.java

📁 用JAVA编写的绘图程序 功能简介: 支持存储
💻 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 + -