tag.paint(graphics);
}
}
public Bounds getBounds(Component component) {
Bounds bounds;
if (tag == null) {
bounds = null;
} else {
int x, y;
switch (horizontalAlignment) {
case LEFT: {
x = xOffset;
break;
}
case RIGHT: {
x = component.getWidth() - tag.getWidth() + xOffset;
break;
}
case CENTER: {
x = (component.getWidth() - tag.getWidth()) / 2 + xOffset;
break;
}
default: {
throw new UnsupportedOperationException();
}
}
switch (verticalAlignment) {
case TOP: {
y = yOffset;
break;
}
case BOTTOM: {
y = component.getHeight() - tag.getHeight() + yOffset;
break;
}
case CENTER: {
y = (component.getHeight() - tag.getHeight()) / 2 + yOffset;
break;
}
default: {
throw new UnsupportedOperationException();
}
}
bounds = new Bounds(x, y, tag.getWidth(), tag.getHeight());
}
return bounds;
}