0

Looking to customise my JTabbedPane to look something like the below:

desired JTabbedPane

As you can see it's quite a simple design so shouldn't be too difficult to achieve? I've read a bit on changing Look and Feel but got a bit lost with the wealth of information and options there. Anyone any useful pointers for me?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Strokes
  • 157
  • 7
  • 23

2 Answers2

3

Changing the look and feel of your complete application is one of the easiest ways to do it. Here is the list (with screen shots, how to use and download links) of different looks and feels for java swing. Use one of them to get some great looks and feels for your swing application.

P.S. Simply put the code into your main method.

Community
  • 1
  • 1
Subhan
  • 1,544
  • 3
  • 25
  • 58
2

As you can see it's quite a simple design so shouldn't be too difficult to achieve?

Creating a custom UI is always a problem. You need to implement the change for all LAF's you intend to support.

You would start by looking at BassicTabbedPaneUI. There you will find the various paintTab...(...) methods. Then you need to look at your LAF, for example the MetalTabbedPaneUI to see if the LAF uses the default implementation or does a custom implementation. Once you know this you override the appropriate class and implement your custom painting code.

Then in your code you have something like:

JTabbedPane tabbedPane = new JTabbedPane(...);
tabbedPane.setUI( new MyCustomTabbedPaneUI() );
camickr
  • 321,443
  • 19
  • 166
  • 288
  • To be honest Im happy enough to use the standard Java swing LAF for most components as i''ve been able to customize them sufficiently without getting in to deep but with the tabs, they seem to be more work. Looking for a hack to get something like my image above if Im being honest... – Strokes Jan 31 '15 at 17:09