How do I copy the layout from a header of a JTabbedPane onto a JPanel?

Posted by Snail on Stack Overflow See other posts from Stack Overflow or by Snail
Published on 2010-04-08T00:07:15Z Indexed on 2010/04/08 0:13 UTC
Read the original article Hit count: 738

Filed under:
|
|
|
|

I have created a "CollapsingPanel"class/sort of a JTabbedPane (code skeleton can be found at http://www.coderanch.com/t/341737/Swing-AWT-SWT-JFace/java/Expand-Collapse-Panels). It is in other words a lot of headers which you click on to show a hidden Panel. At the moment these header-panels are a rectangular box with a LineBorder around them. That is ugly!

I'm wondering if there is a way to copy the layout that the JTabbedPane uses for its headers/titles (which is inhierted from Look&Feel I assume) and use it on my JPanel-based headers? So that my headers get a smooth look which is in line with the rest of the program (based on Look&Feel!) instead of looking like alien flat blocks.

Illustrated below with the headers nicely circled in green ;) I want to apply the header-look from 2nd picture over the red header JPanel in picture 1:

Picture 1: hxxp://img7.imageshack.us/img7/2319/34158982.png - change to http, I got <10 rep :(

Pictrue 2: hxxp://img46.imageshack.us/img46/2572/jtabpane.png

© Stack Overflow or respective owner

Related posts about java

Related posts about jtabbedpane