Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Design question regarding JTabbedPane  RSS feed

 
Ashish Gupta
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I have a design question regarding JTabbedPane. I have JTabbedPane with three tabs. When I launch my application, objects in both tab 2 and 3 are created and other operations done. As I continue to add more tabs and make each tab more feature rich, it takes more time for application to launch. Is there a way to restrict object creation/other operations in tab 2 and 3 to be invoked only when user click on them? I am not sure how to handel this design. Code I am using is as below.


Thanks
Ashish
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can register a ChangeListener with the JTabbedPane, and it will be notified when a new tab is exposed. This would give you a chance to set that tab up the first time the tab is used.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!