• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

How do I create a JTabbedPane with editable tab labels

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do I create a JTabbedPane with editable tab labels
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Faiz Memon:
How do I create a JTabbedPane with editable tab labels



Since 1.6 there is a method JTabbedPane#setTabComponentAt(int index,Component component)
You can use this to provide your custom component which will enable the user to edit the tab label.

If you cannot use 1.6, you might consider using a trigger (JPopupMenu on right clicking the tab perhaps), ask the user for the new text (Using the JOptionPane#showInputDialog() perhaps) and set the new title by using the JTabbedPane#setTitleAt(int index,String title)
 
When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic