JTable Header / Custom  
Author Message
willy





PostPosted: 2003-12-30 12:18:00 Top

java-programmer, JTable Header / Custom 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





PostPosted: 2003-12-30 17:04:00 Top

java-programmer >> JTable Header / Custom willy wrote:
> 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.


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





PostPosted: 2003-12-31 2:17:00 Top

java-programmer >> JTable Header / Custom Robert Karlsson wrote:
> willy wrote:
>
>> 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.
>
>
>
> 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 ); );
[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 ) );

 
 
gregorys





PostPosted: 2003-12-31 7:06:00 Top

java-programmer >> JTable Header / Custom Robert Karlsson <email***@***.com> wrote in message news:<bssfcf$uaud$email***@***.com>...
> Robert Karlsson wrote:
> > willy wrote:
> >
> >> 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.
> >
> >
> >
> > 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 ); );
> [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 ) );

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

Not to mention one double-quote too many.
 
 
willy





PostPosted: 2004-1-3 10:39:00 Top

java-programmer >> JTable Header / Custom
"Robert Karlsson" <email***@***.com> wrote in message
news:bssfcf$uaud$email***@***.com...
> Robert Karlsson wrote:
> > willy wrote:
> >
> >> 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.
> >
> >
> >
> > 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 ); );
> [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 ) );
>

Robert,

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

W-


 
 
usenet





PostPosted: 2004-1-3 21:54:00 Top

java-programmer >> JTable Header / Custom willy <email***@***.com> wrote:


>> 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





PostPosted: 2004-1-5 4:13:00 Top

java-programmer >> JTable Header / Custom Christian Kaufhold wrote:
> willy <email***@***.com> wrote:
>
>
>
>>>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));
>
[snip]


Thanks!

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



.: rob