Setting the Color of a button t0neg0d GUI

Hi there,

I was wondering what the easiest way to set the color of a button was. I notice there’s methods to set the color of certain effects that could happen to the button, but I’m wondering if there’s a simple method to set the color of the button itself, perhaps with a simple RGBAColor

This will tint any image you are using, so not sure if it’s exacty what you meant, but here goes …

[java]
ButtonAdapter b = new ButtonAdapter(screen, new Vector2f(40, 30));
b.getElementMaterial().setColor(“Color”, ColorRGBA.Red);
b.setText(“Button”);
[/java]

RR

@BigBob said: Hi there,

I was wondering what the easiest way to set the color of a button was. I notice there’s methods to set the color of certain effects that could happen to the button, but I’m wondering if there’s a simple method to set the color of the button itself, perhaps with a simple RGBAColor

Just for the sake of verifying the answer you got from @rockfire. This would be the correct way of doing this.

@t0neg0d

Hi there,

I just did this. It seems to have worked, but the buttons are very dull. Like there is shadows on the buttons or something. Is there a way to brighten this up.

I can provide a screen shot if needed

You can just mult() the colour …

[java]
button.getElementMaterial().setColor(“Color”, ColorRGBA.Red.mult(3));
[/java]

@rockfire said: You can just mult() the colour ..

[java]
button.getElementMaterial().setColor(“Color”, ColorRGBA.Red.mult(3));
[/java]

The only alteration I would make to the above is to clone the color first. If you call mult on ColorRGBA.Red… everytime you reference ColorRGBA.Red from this point on it will be the altered version.

EDIT: ignore… mult… not multLocal… just do what he said :wink:

@rockfire

thanks it works and my problem is fixed!

You’re a super smart genius!

@t0neg0d

Luckily I have that handled already :stuck_out_tongue:

thanks!

@t0neg0d said: The only alteration I would make to the above is to clone the color first. If you call mult on ColorRGBA.Red... everytime you reference ColorRGBA.Red from this point on it will be the altered version.

EDIT: ignore… mult… not multLocal… just do what he said :wink:

lol yus. i already learnt my lesson with the difference between mult() and multLocal() early in my JME career with a really stupid bug :S

@rockfire said: lol yus. i already learnt my lesson with the difference between mult() and multLocal() early in my JME career with a really stupid bug :S

I made the mistake of updating Vector3f.ZERO… took me forever to figure out what the hell was going on >.<