1 31 32 package org.antlr.xjlib.appkit.gview.object; 33 34 import org.antlr.xjlib.appkit.gview.base.Rect; 35 import org.antlr.xjlib.appkit.gview.shape.SLabel; 36 import org.antlr.xjlib.foundation.XJXMLSerializable; 37 38 import java.awt.*; 39 40 public class GElementLabel extends GElement implements XJXMLSerializable { 41 42 protected transient Graphics2D g = null; 43 44 public GElementLabel() { 45 super(); 46 } 47 48 @Override 49 public Rect getFrame() { 50 return SLabel.getFrame(getLabel(), getPositionX(), getPositionY(), g); 51 } 52 53 @Override 54 public boolean isInside(Point p) { 55 return getFrame().contains(p); 56 } 57 58 @Override 59 public void draw(Graphics2D g) { 60 super.draw(g); 61 62 this.g = g; 63 if(labelVisible && isVisibleInClip(g)) { 64 g.setColor(labelColor); 65 SLabel.drawCenteredString(getLabel(), (int)getPositionX(), (int)getPositionY(), g); 66 } 67 } 68 69 } 70 | Popular Tags |