Background color for a JideButton?

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Background color for a JideButton?

Postby jeremy_c » Mon Sep 08, 2008 8:20 pm

Is it possible to set the background color of a JideButton? I have tried setBackground w/no luck.

Thanks,

Jeremy
jeremy_c
 
Posts: 19
Joined: Sat Sep 06, 2008 2:55 am

Re: Background color for a JideButton?

Postby JIDE Support » Mon Sep 08, 2008 8:30 pm

You can use setBackgroundOfState to set for different states. The setBackground will work too for the normal state only if you call setContentAreaFilled(true).
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Background color for a JideButton?

Postby jeremy_c » Mon Sep 08, 2008 9:06 pm

I've tried:

Code: Select all
                    b.setBackground(new Color(255, 200, 200));
                    b.setBackgroundOfState(1, new Color(200, 200, 255));
                    b.setBackgroundOfState(0, new Color(200, 200, 255));
                    b.setBackgroundOfState(2, new Color(200, 200, 255));
                    b.setContentAreaFilled(true);


w/no luck. What would be a valid value for state? I cannot determine that from the API docs. Thank you very much!

Jeremy
jeremy_c
 
Posts: 19
Joined: Sat Sep 06, 2008 2:55 am

Re: Background color for a JideButton?

Postby JIDE Support » Mon Sep 08, 2008 9:18 pm

I'll add javadoc for it. The states are defined in ThemePainter. ThemePainter.STATE_DEFAULT, STATE_ROLLOVER, STATE_SELECTED and STATE_PRESSED.

Sorry, setContentAreaFilled should be setOpaque.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Background color for a JideButton?

Postby jeremy_c » Mon Sep 08, 2008 9:50 pm

Ah! Got it. Thanks. It is in the java docs, I missed it. When you pointed me to ThemePainter, I found it pretty easily. Now looking back, I notice that JideButton implements ComponentStateSupport which will get me to ThemePainter, but it was not obvious at start. Sorry, should have read more.

Everything is working great now, thanks for the quick response!

Jeremy
jeremy_c
 
Posts: 19
Joined: Sat Sep 06, 2008 2:55 am

Re: Background color for a JideButton?

Postby JIDE Support » Tue Sep 30, 2008 9:27 am

Just so you know, 2.4.0 is released which adds more javadoc for the methods you have trouble with.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 8 guests