public static final int LINE_V_ALIGN_CENTER = 512;
public static final int LINE_V_ALIGN_BOTTOM = 1024;
private DynaButtons parent;
private Image buttonImage;
private Image highliteImage;
private Image currentImage;
private Color backgroundColor;
private Image backgroundImage;
private String buttonText;
private PopObject popObject;
private Color fontColor;
private Color highliteFontColor;
private Color currentFontColor;
private Font buttonFont;
private int textJustification;
private int textAlignment;
private Image offScreenImage;
private Graphics offScreenGraphics;
private Dimension offScreenSize;
private int getVspace(FontMetrics fm) {
int imgHeight = this.currentImage.getHeight(this);
int vspace;
switch (this.textAlignment & 1792) {
case 256:
vspace = fm.getHeight();
break;
case 512:
vspace = (imgHeight + fm.getHeight()) / 2 - 3;
break;
case 1024:
vspace = imgHeight - 3;
break;
default:
vspace = (imgHeight + fm.getHeight()) / 2 - 3;
}
return vspace;
}
public boolean mouseEnter(Event evt, int x, int y) {
this.currentImage = this.highliteImage;
this.currentFontColor = this.highliteFontColor;
((Component)this).repaint();
this.popObject.setMessageType(1);
this.parent.action(this.popObject);
return false;
}
public void showButtonDown() {
this.currentImage = this.highliteImage;
this.currentFontColor = this.highliteFontColor;
((Component)this).repaint();
}
PopButton(DynaButtons parent, PopObject popObject, String buttonText, Color fontColor, Color highliteFontColor, Font buttonFont, int textJustification, int textAlignment, Image buttonImage, Image highliteImage, Color backgroundColor) {
this.parent = parent;
this.popObject = popObject;
this.buttonText = buttonText;
this.fontColor = fontColor;
this.highliteFontColor = highliteFontColor;
this.buttonFont = buttonFont;
this.textJustification = textJustification;
this.textAlignment = textAlignment;
this.buttonImage = buttonImage;
this.highliteImage = highliteImage;
this.backgroundColor = backgroundColor;
this.currentImage = buttonImage;
this.currentFontColor = fontColor;
((Component)this).repaint();
}
PopButton(DynaButtons parent, PopObject popObject, String buttonText, Color fontColor, Color highliteFontColor, Font buttonFont, int textJustification, int textAlignment, Image buttonImage, Image highliteImage, Image backgroundImage) {
this.parent = parent;
this.popObject = popObject;
this.buttonText = buttonText;
this.fontColor = fontColor;
this.buttonFont = buttonFont;
this.textJustification = textJustification;
this.textAlignment = textAlignment;
this.buttonImage = buttonImage;
this.highliteImage = highliteImage;
this.backgroundImage = backgroundImage;
this.currentImage = buttonImage;
this.currentFontColor = fontColor;
((Component)this).repaint();
}
public boolean mouseExit(Event evt, int x, int y) {
this.currentImage = this.buttonImage;
this.currentFontColor = this.fontColor;
((Component)this).repaint();
this.popObject.setMessageType(0);
this.parent.action(this.popObject);
return false;
}
private void drawBackground(Graphics g) {
if (this.backgroundColor != null) {
g.setColor(this.backgroundColor);
Dimension d = ((Component)this).size();
g.fillRect(0, 0, d.width, d.height);
} else if (this.backgroundImage != null) {
int imHeight = this.backgroundImage.getHeight(this);
int imWidth = this.backgroundImage.getWidth(this);
Dimension d = ((Component)this).size();
int x = d.width / imWidth + 1;
int y = d.height / imHeight + 1;
for(int i = 0; i < y; ++i) {
for(int j = 0; j < x; ++j) {
g.drawImage(this.backgroundImage, j * imWidth, i * imHeight, this);
}
}
}
}
public void paint(Graphics g) {
this.drawBackground(g);
if (this.buttonImage != null) {
g.drawImage(this.currentImage, 0, 0, this);
}
g.setFont(this.buttonFont);
FontMetrics fm = g.getFontMetrics(g.getFont());
int hspace = this.getHspace(fm);
int vspace = this.getVspace(fm);
g.setColor(this.currentFontColor);
g.drawString(this.buttonText, hspace, vspace);
}
public final synchronized void update(Graphics theG) {