• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTabbedPane setting tab names with (sets? serialized objs, from file read?)  RSS feed

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would be the best way to have a set of jTabbed panes' tab names load the same each time the program runs. An example is the tabs in a worksheet in excel.

I have several tabs now that load from an array. How is loading JTabbedPanel tab name done if they are changed or removed etc?
Thanks
 
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are setting the tab labels when you add new tabs. You can later change them using JTabbedPane.setTitleAt. JTabbedPane.getTitleAt can retrieve them.

You need to store the current labels when you close your application and and restore them when you restart. You can use several storage solutions for that; java.util.pref.Preferences, properties files that you read/write using java.util.Properties and XML files are all possible solutions.
 
James Howerton
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exelent solution.

I will have to study the Class Properties class.


 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!