Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / January 2004

Tip: Looking for answers? Try searching our database.

JTable Header / Custom

Thread view: 
willy - 30 Dec 2003 04:17 GMT
Hi,

I'd like to change the L&F of the JTable Header but I'm not sure how to do
this.

Basically, I want the header columns to look flat instead of raised, with a
custom background color.

Thanks for any Tips.

WT-
Robert Karlsson - 30 Dec 2003 09:04 GMT
> Hi,
>
[quoted text clipped - 3 lines]
> Basically, I want the header columns to look flat instead of raised, with a
> custom background color.

If I'm not mistaken you should use the following properties
to get the desired result.

"TableHeader.font"
"TableHeader.background"
"TableHeader.cellBorder"

One way to set these properties is by..

UIManager.put( "TableHeader.background"", new Color( 200, 0, 0 ); );
etc..

Hope that helps.

 :: Robert

> Thanks for any Tips.
>
> WT-
Robert Karlsson - 30 Dec 2003 18:16 GMT
>> Hi,
>>
[quoted text clipped - 16 lines]
>
> UIManager.put( "TableHeader.background"", new Color( 200, 0, 0 ); );
[snip]

I was a bit too quick there and one semi-colon too many
showed up. The line should read:

UIManager.put( "TableHeader.background"", new Color( 200, 0, 0 ) );
Gregory A. Swarthout - 30 Dec 2003 23:05 GMT
> >> Hi,
> >>
[quoted text clipped - 22 lines]
>
> UIManager.put( "TableHeader.background"", new Color( 200, 0, 0 ) );

-----------------------------------------^

Not to mention one double-quote too many.
willy - 03 Jan 2004 02:39 GMT
> >> Hi,
> >>
[quoted text clipped - 22 lines]
>
> UIManager.put( "TableHeader.background"", new Color( 200, 0, 0 ) );

Robert,

Your suggestion worked just fine for what I needed to do... with a few
quirks I ironed out with some fiddling.
Thanks,

W-
Christian Kaufhold - 03 Jan 2004 13:54 GMT
>> I was a bit too quick there and one semi-colon too many
>> showed up. The line should read:
>>
>> UIManager.put( "TableHeader.background"", new Color( 200, 0, 0 ) );

The line should read:

UIManager.put("TableHeader.background", new ColorUIResource(200, 0, 0));

But there is no need to change these *global* settings. Just use a custom
header renderer and set there any colors etc. you want.

Christian
Robert Karlsson - 04 Jan 2004 20:12 GMT
>>>I was a bit too quick there and one semi-colon too many
>>>showed up. The line should read:
[quoted text clipped - 4 lines]
>
> UIManager.put("TableHeader.background", new ColorUIResource(200, 0, 0));

[snip]

Thanks!

Hmm, that was annoying. I think I'm going blind :-)

 .: rob


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.