• 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
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

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: 41995
911
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.
 
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic