• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help! Need JTabbedPane tabs to be on same line!

 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTabbedPane that I dynamically add/remove tabs to/from. The adding and removing works fine, but I find that swing tends to want to create another tab run once the current run gets as wide as the window.
I'd like the window to get wider as tabs are added, and keep the tabs to one run. Is there a way to do this?
 
Sayed Ibrahim Hashimi
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should re-word your question or give more info. Right now it isn't making a whole lot of sense. No one can help you if they dont know what you are talking about.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure why you have a problem with the question, it's perfectly understandable. Just thought I'd say that.
 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Mike!
I think I'm going to have to extend BasicTabbedPaneUI and overload calculateTabWidth() to get this to work. If I can get my custom UI to dynamically calculate the width of all the tabs, then it shoudln't be too difficult to compare the total tab width to the width of the window, and make adjustments as necessary.
Originally posted by Mike Curwen:
I'm not sure why you have a problem with the question, it's perfectly understandable. Just thought I'd say that.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!