• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to add new tabs from JMenu

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a JMenu class (GoofyMenuBar.java) and a JTabbedPane class (LoginTabbedPane.java) that I�m putting into a splitPane (SplitPane.java).

Clicking on the Go button opens a new tab. I need to invoke the same action from the menu but somehow I�m not making the connection between the components.

Regardless of the ugliness, how can I invoke a method on JTabbedPane from the JMenu, and later from the JToolBar. Apparently, simply instantiating the class does not do the trick.

Appreciate the input.


LoginTabbedPane


GoofyMenuBar.java


SplitPane
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you want item1 of the menu to create/add an info page?
(same as clickig the 'Go' button)

if so, follow the changes here, and you should get it to work OK

the main differences are the passing of the LoginTabbedPane reference to the
GoofyMenuBar class, and the creation of a separate method to create/add
the info page - this can then be called by both the Go button and the menu item

note: lots of 'comment-outs', just to get it to compile - I don't have
programix.* stuff, or FormLayout stuff. I put them all in one java file,
but you have 2 x main()

you will probably need to handle a second click on the menu item - do you
want a second info page created/added etc etc



 
Med Shabe
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Michael.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic