Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By Norm

Thread: Showing multi frames within a single main frame

  1. #1
    chandrupsekar is offline Member
    Join Date
    Dec 2010
    Posts
    7
    Rep Power
    0

    Default Showing multi frames within a single main frame

    I have a main frame (say WelcomeForm) which has 2 buttons. On a button click it should open respective UIs for further actions.As of now the UI opens in a separate window. I want it to open in the same window( no separate frame or window). I use a single frame application. I have included a code snippet to give more information.

    import org.jdesktop.application.FrameView;
    import org.jdesktop.application.SingleFrameApplication;

    public class WelcomeForm extends FrameView {

    public WelcomeForm(SingleFrameApplication app) {
    super(app);

    jButton1 = new javax.swing.JButton();
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt,splitPane);
    }
    });
    }

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    GUIApplication.getApplication().openclone();
    }
    }


    import org.jdesktop.application.Application;
    import org.jdesktop.application.SingleFrameApplication;

    public class GUIApplication extends SingleFrameApplication {

    public static GUIApplication getApplication() {
    return Application.getInstance(GUIApplication.class);
    }

    public void openclone() {
    show(new GUIView(GUIApplication.getApplication()));
    }
    }

    GUIView is another single frame application which opens as a separate window. I want this to open in the same window itself. What possible ways would this be possible. JInternalFrame is not to be used since it has own window closing resizing.

    please post your valuable suggestions

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: Showing multi frames within a single main frame

    Have you looked at the CardLayout class?
    Fubarable likes this.

  3. #3
    chandrupsekar is offline Member
    Join Date
    Dec 2010
    Posts
    7
    Rep Power
    0

    Default Re: Showing multi frames within a single main frame

    No, havent looked at the CardLayout class. But basically I want to know whether I can use any kind of frame (without having window close, restore) or should I use only panels. If I want to use Cardlayout only I can use Panel as internal container, correct?

  4. #4
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,234
    Rep Power
    7

  5. #5
    chandrupsekar is offline Member
    Join Date
    Dec 2010
    Posts
    7
    Rep Power
    0

    Default Re: Showing multi frames within a single main frame

    Using Internal Frame is another frame inside the main frame is again a window, I need to use it just like the CardLayout but use singleframeapplication instead of panels. I need to know if there is any way where I can configre or modify a single frame application (or FrameView) to a panel

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Showing multi frames within a single main frame

    Quote Originally Posted by chandrupsekar View Post
    Using Internal Frame is another frame inside the main frame is again a window, I need to use it just like the CardLayout but use singleframeapplication instead of panels. I need to know if there is any way where I can configre or modify a single frame application (or FrameView) to a panel
    This makes no sense to me. You add a JPanel to your JFrame's contentPane and use the JPanel as the card layout container. Simple as that.

  7. #7
    chandrupsekar is offline Member
    Join Date
    Dec 2010
    Posts
    7
    Rep Power
    0

    Default Re: Showing multi frames within a single main frame

    Thanks friend, will try that and will get back if I face any issues

Similar Threads

  1. Multi-Jpanels in single JFrame
    By _-Blackhawk-_ in forum AWT / Swing
    Replies: 10
    Last Post: 09-13-2011, 03:52 PM
  2. Single to multi-dimension array
    By Migy in forum New To Java
    Replies: 2
    Last Post: 04-05-2011, 06:12 PM
  3. Java slave Frame access to its owner main frame problem
    By cagdaseckin in forum New To Java
    Replies: 0
    Last Post: 12-10-2010, 10:40 AM
  4. GUI - how do I get frames within a frame
    By AJArmstron@aol.com in forum New To Java
    Replies: 1
    Last Post: 04-28-2010, 02:00 AM
  5. Single and Multi Selection Lists
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-02-2008, 08:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •