Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding java programs into JFrame

 
bert ngo
Greenhorn
Posts: 6
  • 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
  • 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
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • 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
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic