aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Adding java programs into JFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Adding java programs into JFrame" Watch "Adding java programs into JFrame" New topic
Author

Adding java programs into JFrame

bert ngo
Greenhorn

Joined: Nov 20, 2008
Posts: 6
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

Joined: Jun 09, 2003
Posts: 4632
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

Joined: Jul 11, 2001
Posts: 15300
    
    6

or put each panel on a tab of a JTabbedPane.


GenRocket - Experts at Building Test Data
bert ngo
Greenhorn

Joined: Nov 20, 2008
Posts: 6
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding java programs into JFrame