Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2010
    Posts
    59
    Rep Power
    0

    Cool GUI - how do I get frames within a frame

    Hi. What I want to do is to display some kind of java boxes within a JFrame.

    At the moment I have a program that consists of a JFrame, JMenu and JButtons and the user can enter some text in a JTextArea. The user can also load or save text using JFileChooser.

    The program displays statistics about the text. However, all of the display boxes/panes appear outside of the main JFrame.

    What I want to do is display the various statistics and JFileChooser panes inside the JFrame.

    I would be grateful if someone could give me some ideas as to how one goes about doing this.

    Many thanks!

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

    Default

    You can use several JPanels and give them borders such as line borders or titled borders. Have a look at the BorderFactory API for more on this. There may be a tutorial for this as well, but I'm not sure.

    Edit: yep -- How to use Borders

    Edit 2: as for JFileChooser, since it is subclassed from JComponent, you can add one of these into your application as easily as you add a JPanel into it.
    Last edited by Fubarable; 04-28-2010 at 03:04 AM.

Similar Threads

  1. navigation b/w frames
    By imrankhan in forum AWT / Swing
    Replies: 3
    Last Post: 03-19-2012, 01:25 PM
  2. jsp frames
    By vasug in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 04-16-2010, 06:00 PM
  3. Switching Frames
    By jonnytabpni in forum New To Java
    Replies: 1
    Last Post: 11-08-2009, 11:12 PM
  4. Replies: 7
    Last Post: 11-02-2009, 07:31 PM
  5. Help regarding Frames
    By ramesh.8189 in forum AWT / Swing
    Replies: 14
    Last Post: 02-15-2009, 09:12 AM

Posting Permissions

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