Hi,
I’ve a set of buttons based on tonegodGUI. I’ve set the color of the text in these button to white, but after doing a click, the color changes and apperas a bit grayed. I’ve looking for a function to change this behavior but I didn’t found anything.
Any ideas??
Temporary solution:
[java]
@Override
public void onButtonLostFocus(MouseMotionEvent evt) {
buttonr.setFontColor(ColorRGBA.White);
}
[/java]
@t0neg0d will need to answer to give you a full response
1 Like
There are two methods on the Button class that may help …
[java]setButtonPressedInfo(String pathPressedImg, ColorRGBA pressedFontColor);
setButtonHoverInfo(String pathHoverImg, ColorRGBA hoverFontColor); [/java]
You can pass null as the image path, and just provide color.
Thanks for your answers!!!
Dan’s solutions works very fine.
Rockfire, I already use the setButtonHoverInfo(String pathHoverImg, ColorRGBA hoverFontColor) function but it doesn’t solve my problem.
t0neg0d
December 28, 2013, 5:46pm
5
@rockfire said:
There are two methods on the Button class that may help ..
[java]setButtonPressedInfo(String pathPressedImg, ColorRGBA pressedFontColor);
setButtonHoverInfo(String pathHoverImg, ColorRGBA hoverFontColor); [/java]
You can pass null as the image path, and just provide color.
These allow you to change the font color. If you would like to keep the image changes, use the following:
[java]
setButtonHoverInfo(
screen.getStyle(“Button”).getString(“hoverImg”),
someColorRGBA
);
setButtonPressedInfo(
screen.getStyle(“Button”).getString(“pressedImg”),
someColorRGBA
);
[/java]
You can also clear both Hover and Pressed states: Which removes the image change and the color changes
[java]
clearAltImages();
[/java]
Thanks t0negod, I finally use your last solution and it works very well!!