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); } }
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); }
/** * sets the border of the tooltip, the default border is 4px. * * @param theValue * @return Tooltip */ public Tooltip setBorder(int theValue) { borderSize = theValue; label.getStyle().setMargin(borderSize, borderSize, borderSize, borderSize); return this; }
/** * sets the border of the tooltip, the default border is 4px. * * @param theValue * @return Tooltip */ public Tooltip setBorder(int theValue) { _myBorder = theValue; _myLabel.getStyle().setMargin(_myBorder, _myBorder, _myBorder, _myBorder); return this; }