UsageException errorVar = new UsageException("You cannot specify both Width and VisibleColumns");
ErrorMgr.addError(errorVar);
throw errorVar;
}
setForm(form);
TextGraphic tg = GraphicFactory.newTextGraphic(text);
if (font != null)
tg.setFont(font);
tg.setSize(tg.getPreferredSize());
java.awt.Point p = location(startX, startY);
setYPen(form, p.y);
tg.setVisible(true);
ColourChange.setForeground(tg, penColor);
if (width > -1)
Width.set(tg, width);
else if (visibleColumns > -1)
Width.set(tg, UIutils.pixelsToMils(UIutils.colsToPixels(visibleColumns, tg)));
switch (horizAlign) {
case Constants.TA_RIGHT:
tg.setHorizontalAlignment(JLabel.RIGHT);
WidgetX.set(tg, p.x - Width.get(tg));
setXPen(form, WidgetX.get(tg));
break;
case Constants.TA_CENTER:
tg.setHorizontalAlignment(JLabel.CENTER);
WidgetX.set(tg, WidgetX.get(tg) + (Width.get(tg)/2));
break;
default:
tg.setHorizontalAlignment(JLabel.LEFT);
WidgetX.set(tg, p.x);
setXPen(form, WidgetX.get(tg) + Width.get(tg));
break;
}
WidgetY.set(tg, p.getY());