55import paintcomponents .PaintComponent ;
66import paintcomponents .TextPaintComponent ;
77
8+ /**
9+ * the text annotation of the component
10+ * @author muchi
11+ *
12+ */
813public class TextAnnotation extends PaintComponentAnnotation {
914
1015 private TextPaintComponent textPaintComponent ;
1116
12-
17+ /**
18+ * create the annotation of a component with information
19+ *
20+ * @param attachedComponent the component attached to the annotation
21+ * @param displayingText the information to be displayed
22+ */
1323 public TextAnnotation (PaintComponent attachedComponent , String displayingText ) {
1424 super (attachedComponent );
1525 this .textPaintComponent = new TextPaintComponent (displayingText , attachedComponent .getX (),
16- attachedComponent .getY ());
17-
26+ attachedComponent .getY ());
1827 }
1928
2029 @ Override
2130 protected void paintNotSelected (Graphics g ) {
22- // TODO Auto-generated method stub
2331 textPaintComponent .updateBounds (g );
2432 textPaintComponent .setY (getAttachedComponent ().getY () - textPaintComponent .getRowHeight ());
2533 textPaintComponent .paint (g );
@@ -33,15 +41,32 @@ protected void paintSelected(Graphics g) {
3341 textPaintComponent .paint (g );
3442 }
3543
44+ /**
45+ * @return true if the given position is contained, otherwise false
46+ */
3647 @ Override
3748 public boolean contains (int x2 , int y2 ) {
3849 // TODO Auto-generated method stub
3950 return textPaintComponent .contains (x2 , y2 );
4051 }
4152
53+ /**
54+ * move the text
55+ *
56+ * @param x the movement on x-position
57+ * @param y the movement on y-position
58+ */
4259 public void translate (int x , int y ){
4360 textPaintComponent .translate (x , y );
4461 }
45-
46-
62+
63+ /**
64+ * set the font size of the given annotation
65+ *
66+ * @param input the size
67+ */
68+ @ Override
69+ public void setFontSize (float input ) {
70+ textPaintComponent .setFontSize (input );
71+ }
4772}
0 commit comments