• Post Reply Bookmark Topic Watch Topic
  • New Topic

questions about jtabbedpane

 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i got a few questions regarding jtabbedpane.

is it possible to set a jtabbedpane tab's border? i would like to set no borders to it

default all tabs will be positioned from the left. is it possible to place a tab on the far right? i dont see any methods in the api that can possibly do these things so im guessing overriding it and customizing it is the only way?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out what the method setComponentOrientation does.
For playing around with borders, see this http://www.jroller.com/santhosh/date/20050521#get_rid_of_ugly_jtabbedpane
 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi maneesh, thanks for that. unfortunately, that method sets all tab's orientatation.

what i want is to have the 1st N tabs on the left, then have the last tab on the rightmost.

also with regards to the border, i actually want to add a button in the tabs area but so far i dont see anything that makes it possible so i added a tab instead
tabbedpane.addTab(null, null);

and used setComponentAt() to add the button there
tabbedPane.setTabComponentAt(tabbedPane.getTabCount()-1, jbutton);

and i would like the tab's borders to be gone so that its background would blend in with the pane's background color.
 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ah.. i would like to share in case anyone's interested.

BasicTabbedPaneUI's paintTabBorder can be overridden

ill have to do more work on this. overriding the method without putting any code in it will remove the tab's borders. even calling super.paintTabBorder won't work
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible to place a tab on the far right?

what i want is to have the 1st N tabs on the left, then have the last tab on the rightmost.


If you are going to keep switching your questions, I doubt people will be encouraged to help you out in the future.
 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi maneesh, i wasnt switching questions. i did say "a" tab. the setcomponentorientation() affects all tabs, that is why i gave another detailed explanation because the first question may have been vague, i apologize for that.
 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just in case anyone is interested, i posted my code and a little explanation on what the code does in

http://tech.chitgoks.com/2009/12/13/create-a-logout-button-beside-a-jtabbedpane/

i successfully added the logout button together with the other tabbed panes and placing the button on the far right
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!