• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Netbeans 5 : add component using addLayoutComponent() problem

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello :-)

I am trying to add three JTabbedPane's ( each with sub-components ) to a JPanel. The JPanel uses a CardLayout and as I need to change the specific JTabbedPane dynamically at runtime, I need to use addLayoutComponent( Container container, Object name ) so that I can change the displayed component by calling show( Container parent, Object name ).

When I add the JTabbedPane's using the GUI editor, the calls to show(...) do nothing - I am guessing that this is because the GUI editor does not automatically detect that components added to a cardLayout managed JPanel usually require dynamic display. Instead, the GUI editor uses a straight forward add(...) method.

I am new to Netbeans. How do I add the JTabbedPane's to a CardLayout managed JPanel so that I can dynamically display specific JTabbedPane's at runtime using show(...)

Thanks.

Darren
 
D R Wilkinson
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I may have solved this on my own.

I will post the solution here ( once I am sure ) so it may be of use for anyone else with a similar question.
 
author & internet detective
Posts: 42165
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by D R Wilkinson:
I think I may have solved this on my own.

I will post the solution here ( once I am sure ) so it may be of use for anyone else with a similar question.


That would be much appreciated!
 
D R Wilkinson
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The solution was to simply call validate() on the parent component that displays the card layout managed sub-components.

Note To Self : Read the API a little bit more carefully.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic