Esempio n. 1
0
 public void setStyle(ButtonStyle style) {
   if (!(style instanceof ImageTextButtonStyle))
     throw new IllegalArgumentException("style must be a ImageTextButtonStyle.");
   super.setStyle(style);
   this.style = (ImageTextButtonStyle) style;
   if (image != null) updateImage();
   if (label != null) {
     ImageTextButtonStyle textButtonStyle = (ImageTextButtonStyle) style;
     LabelStyle labelStyle = label.getStyle();
     labelStyle.font = textButtonStyle.font;
     labelStyle.fontColor = textButtonStyle.fontColor;
     label.setStyle(labelStyle);
   }
 }
Esempio n. 2
0
 public void draw(SpriteBatch batch, float parentAlpha) {
   updateImage();
   Color fontColor;
   if (isDisabled && style.disabledFontColor != null) fontColor = style.disabledFontColor;
   else if (isPressed() && style.downFontColor != null) fontColor = style.downFontColor;
   else if (isChecked && style.checkedFontColor != null)
     fontColor =
         (isOver() && style.checkedOverFontColor != null)
             ? style.checkedOverFontColor
             : style.checkedFontColor;
   else if (isOver() && style.overFontColor != null) fontColor = style.overFontColor;
   else fontColor = style.fontColor;
   if (fontColor != null) label.getStyle().fontColor = fontColor;
   super.draw(batch, parentAlpha);
 }