aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Frames Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Frames" Watch "Frames" New topic
Author

Frames

dhanasekaran mani
Greenhorn

Joined: Aug 29, 2006
Posts: 6
iam having a class called first.java which uses frames and menus, when Click the menu item name file, new class called second.java is executed, but it opens in a new window, i want the first.java container to display the execution of second.java

help me.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
use a CardLayout()

whatever displays in first.java, is card(0), then, instead of a frame for
second.java, use a JPanel, then add second.java as card(1)

the actionListener for the menuItem just has card.next(..), to display second.java

more info

http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Frames