File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Change the shape of Tabs in Tabbed pane to oval Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Change the shape of Tabs in Tabbed pane to oval" Watch "Change the shape of Tabs in Tabbed pane to oval" New topic
Author

Change the shape of Tabs in Tabbed pane to oval

Archana Venu Aradhyula
Greenhorn

Joined: Nov 05, 2008
Posts: 13
Hi

I use a JTabbed pane in my application. I want to change the shape of the tabs to oval or round.Do i need to override the paint method of JTabbed pane?


Thanks
-- Archana
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
you will need to dig into the tabbedPaneUI
Archana Venu Aradhyula
Greenhorn

Joined: Nov 05, 2008
Posts: 13
Can you please help me with the code.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4529
    
    5

Originally posted by Archana Venu Aradhyula:
Can you please help me with the code.


Sure. You go first.


luck, db
There are no new questions, but there may be new answers.
Archana Venu Aradhyula
Greenhorn

Joined: Nov 05, 2008
Posts: 13
I don't know how to start with.
Suraj Chandran
Ranch Hand

Joined: May 20, 2008
Posts: 53
Please dont ask for code... But this is the way it is to be done.
1) First you have to extend BasicTabbedPaneUI
2) Override paintContentBorder() and draw ovals (instead of fillRect as in BasicTabbedPaneUI) and don't call super.paintContentBorder()
3) Override paintTabArea() to draw Ovals or images or whatever.
4) Dont forget to set the UI of your tabbedpane to the new ui class you just made above
Trust me its simple. Just start doing..

cheers, suraj


I guess there are couple of design issues in this classic software the GOD coded.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Simple is relative. I'd recommend just finding a Look and Feel that already does it for you. If you are using Java1.6 Nimbus L&F has corner rounded tabs.


GenRocket - Experts at Building Test Data
 
 
subject: Change the shape of Tabs in Tabbed pane to oval