Skip to main content

JNTable / JXTable selection backgroundcolor

2 replies [Last post]
Anonymous

I was trying to set the selection background color using the following code:

jntable.getTable().setSelectionBackground(Color.red);

JXTable extends JTable so callingsetSelectionBackground should set the
selection backgrond color, right ?
Am i missig something here ?

Thanks.
Ricardo Lopes.

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Kleopatra

Ricardo Lopes wrote:
> I was trying to set the selection background color using the following code:
>
> jntable.getTable().setSelectionBackground(Color.red);
>
> JXTable extends JTable so callingsetSelectionBackground should set the
> selection backgrond color, right ?

Hmm, no and yes: no if there is any Highlighter set and yes if there is
none. That's the behaviour I'm seeing, didn't try too hard to excercise
the highlighters, though :-) Maybe you can show a short piece of running
code demonstrating the problem?

Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Ricardo Lopes

I had an AlternatedRowHighlighter on the JNTable that was causing the
problem, after i call setSelectedBackground on the Highlighter works fine.

Thanks.
RIcardo Lopes.

Kleopatra wrote:

> Ricardo Lopes wrote:
>
>> I was trying to set the selection background color using the
>> following code:
>>
>> jntable.getTable().setSelectionBackground(Color.red);
>>
>> JXTable extends JTable so callingsetSelectionBackground should set
>> the selection backgrond color, right ?
>
>
> Hmm, no and yes: no if there is any Highlighter set and yes if there
> is none. That's the behaviour I'm seeing, didn't try too hard to
> excercise the highlighters, though :-) Maybe you can show a short
> piece of running code demonstrating the problem?
>
>
> Jeanette
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
> For additional commands, e-mail: jdnc-help@jdnc.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net