Hello,
I've got a problem with coloring a jtabbedpane:
I've done a:
panel.setBackground(c);
to change to background of the panel (the content of the jtabbedpane).
and a:
tpmain.setBackgroundAt(i, c);
to change the background a a specific tab.
But as illustrated on the screenshot:
http://img143.echo.cx/img143/2648/tab4qt.gif
there is a grey 2 pixel line between the tab and the tab contents.
How can i remove this grey line?
Kind regards,
Jaap Zeerijk
Thomas Weidenfeller - 10 May 2005 11:02 GMT
> Hello,
>
[quoted text clipped - 6 lines]
> tpmain.setBackgroundAt(i, c);
> to change the background a a specific tab.
I would guess (and it is only a guess) that this is the foreground color
of the JTabbedPane. What happens if you change that color?
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
Jaap Zeerijk - 10 May 2005 11:14 GMT
>> Hello,
>>
[quoted text clipped - 9 lines]
>I would guess (and it is only a guess) that this is the foreground color
>of the JTabbedPane. What happens if you change that color?
Not much ;-)
tpmain.setForeground(Color.green);
panel.setForeground(Color.green);
tpmain.setForegroundAt(i, Color.green);
The line stays grey.
Jaap Zeerijk
John McGrath - 11 May 2005 21:34 GMT
> I've got a problem with coloring a jtabbedpane:
> there is a grey 2 pixel line between the tab and the tab contents.
>
> How can i remove this grey line?
That is the content border area. There is no public JTabbedPane
properties that control this, but it can be controlled using the
UIDefaults table. If you want to make changes for a single JTabbedPane,
you will have to adjust the UIDefaults when the UI delegate is installed
and then adjust it back. Otherwise, you can just change the UIDefaults as
desired.
The size of the line is controlled by the "TabbedPane.contentBorderInsets"
UIDefaults property. The color of the line that you refer to is
controlled by "TabbedPane.contentAreaColor", but other lines are drawn in
that insets area as well. Setting the insets to [1,1,1,1] should get rid
of most of the line, but you will still be left with a 1-pixel wide line
at the bottom of the selected tab.
You can set the color of that line with "TabbedPane.contentAreaColor". If
you delete "TabbedPane.contentAreaColor" from the UIDefaults table, it
will paint the same color as the selected tab.

Signature
Regards,
John McGrath