|
@ -4,6 +4,30 @@ import java.awt.*; |
|
|
|
|
|
|
|
|
public class TextView implements Drawable |
|
|
public class TextView implements Drawable |
|
|
{ |
|
|
{ |
|
|
|
|
|
public enum AnchorType { Left, Center, Right }; |
|
|
|
|
|
|
|
|
|
|
|
private String text; |
|
|
|
|
|
|
|
|
|
|
|
private Point position; |
|
|
|
|
|
|
|
|
|
|
|
private boolean visible; |
|
|
|
|
|
|
|
|
|
|
|
private AnchorType anchor; |
|
|
|
|
|
|
|
|
|
|
|
public TextView(String text, Point position) |
|
|
|
|
|
{ |
|
|
|
|
|
this(text, position, true); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public TextView(String text, Point position, boolean visible) |
|
|
|
|
|
{ |
|
|
|
|
|
this.text = text; |
|
|
|
|
|
this.position = position; |
|
|
|
|
|
this.visible = visible; |
|
|
|
|
|
this.anchor = AnchorType.Center; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void draw(Graphics g) |
|
|
public void draw(Graphics g) |
|
|