summaryrefslogtreecommitdiffstats
path: root/src/subconscious/graphics/widget/Widget.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/subconscious/graphics/widget/Widget.java')
-rw-r--r--src/subconscious/graphics/widget/Widget.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/subconscious/graphics/widget/Widget.java b/src/subconscious/graphics/widget/Widget.java
index 0da1b40..4b97769 100644
--- a/src/subconscious/graphics/widget/Widget.java
+++ b/src/subconscious/graphics/widget/Widget.java
@@ -6,6 +6,10 @@ import java.awt.Point;
public abstract class Widget {
+
+ public static final int BORDER = 10;
+ public static final int TEXT_LINES_SPACING = 5;
+
public enum Anchor {
SO, S, SE, E, NE, N, NO, O
}
@@ -29,6 +33,13 @@ public abstract class Widget {
// at the widget's coordinates with the widget's size
public abstract void render(Graphics2D g);
+ /* helper methods */
+ protected void drawLineString(Graphics2D g, String text, int x, int y, int line) {
+ g.drawString(text, x,
+ y + (TEXT_LINES_SPACING + g.getFontMetrics().getHeight()) * line
+ );
+ }
+
/* accessors */
public Rectangle getRect() {
return new Rectangle(this.x, this.y, this.width, this.height);