namelabel.java

来自「Petri网分析工具PIPE is open-source」· Java 代码 · 共 86 行

JAVA
86
字号
package pipe.dataLayer;import javax.swing.JLabel;/** * <b>NameLabel</b> - This class is for the labels of PN Objects * * @see </p><p><a href="uml\NameLabel.png">NameLabel UML</a></p> * @version 1.0 * @author Camilla Clifford */public class NameLabel extends JLabel{  public int positionX;  public int positionY;  private double xCoord;  private double yCoord;  public int arcboundsLeft;  public int arcboundsTop;  private String id = null;  public NameLabel(){  	super();  }  public NameLabel(String text){    super(text);    setHorizontalAlignment(LEFT);    setVerticalAlignment(TOP);  }  public NameLabel(double positionXInput, double positionYInput, String text, String idInput) {  	super (text);  	id = idInput;  	xCoord = positionXInput;  	yCoord = positionYInput;  }// These functions aren't needed  //  public void arcboundsSet(int boundsLoffset, int boundsToffset, int arcWidth, int arcHeight){//    arcboundsLeft = boundsLoffset;//    arcboundsTop = boundsToffset;//    setBounds(arcboundsLeft, arcboundsTop, arcWidth, arcHeight);//  }//  public void paintComponent(Graphics g){//    super.paintComponent(g);//  }    public void setPosition(int x, int y) {  	positionX = x;  	positionY = y;  	updatePosition();  }    public void updateSize() {    // To get round Java bug #4352983 I have to expand the size a bit   	setSize((int)(getPreferredSize().width*1.2),(int)(getPreferredSize().height*1.2));  	updatePosition();  }    public void updatePosition() {  	setLocation(positionX-getPreferredSize().width,positionY-getPreferredSize().height);  }    public void translate(int x, int y) {  	setPosition(positionX+x, positionY+y);  }    public double getYPosition() {  	return yCoord;  }    public double getXPosition() {  	return xCoord;  }    public String getID() {  	return id;  }  public void setID(String idInput) {  	id = idInput;  }}

⌨️ 快捷键说明

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