• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding java programs into JFrame

 
bert ngo
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need some help getting my last assignment finish and I am having a hard time finding help with this one. The goal of this last assignment is to take 6 program examples the professor has provided and put them into one top level container. I need some assistance being pointed into the right direction with this one.

Thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
assuming the 6 prior examples are swing based:
ensure all 6 are built around a JPanel
create another JPanel set as a cardLayout
add the 6 examplePanels to the cardlayoutPanel
add the cardlayoutPanel to a JFrame
create a JMenu "Examples", with 6 JMenuItems "Example 1" to "Example 6"
add an actionListener to each menuItem, to show its respective panel
set the frame's menuBar

that's about it
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
or put each panel on a tab of a JTabbedPane.
 
bert ngo
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read Michael Dunn's idea with the cardLayout into a JFrame and it's been going well so far. Thanks Michael in pointing me in the right direction and the java tutorials are helping work out the cardLayout.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic