Results 1 to 3 of 3
  1. #1
    mystxx is offline Member
    Join Date
    Jun 2010
    Rep Power

    Default JFrame problem - need suggestions

    Hi all.

    I'm having the following problem:
    I wrote an application - desktop application. It has a total of 5 windows. Each window is it's own class extending the Main class which extends the JFrame class.

    Now, the problem is when I open and close the windows from within the application in Windows taskbar you can see windows closing and opening. I.e. when I switch a screen (window) in my application you can see the previous screen closing and new screen or a window opening. It looks a little funky in the taskbar.

    Now, can someone suggest what would be the best approach to change this?
    I was considering using the JInternalFrame instead of JFrame but this doesn't seem like a good solution.

    Has anoyone been in a similar situation? What should I do?

    The main goal is to change the screens within one window so taskbar wouldn't show many windows opening and closing.

    Thank you all for your time and knowledge.

  2. #2
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Rep Power


    You may wish to have a look at a CardLayout.

    The general scheme here is to gear your GUI's to create JPanels, not JFrames, and in fact have the main app create the one and only JFrame. Then when you wish to change views, swap JPanel(s) in the JFrame by using a CardLayout. The Sun Swing tutorials can show you how to do this.

    How to Use CardLayout (The Java™ Tutorials > Creating a GUI With JFC/Swing > Laying Out Components Within a Container)

  3. #3
    mystxx is offline Member
    Join Date
    Jun 2010
    Rep Power


    Thanx curmudgeon

    I reviewed the docs and that's what I basically did in my application but the wrong way. I see there are methods for first, next, previous, last... in CardLayout and I did the same thing in my application using Stack and stacking JFrames to it - now I see that was unneccessary.

    Thanx again, I'll try with CardLayout and JPanels.

Similar Threads

  1. JFrame resizing problem
    By Bluefox815 in forum AWT / Swing
    Replies: 7
    Last Post: 02-24-2011, 07:56 PM
  2. Problem-----JFrame
    By HariPrasad in forum AWT / Swing
    Replies: 2
    Last Post: 07-28-2009, 12:34 PM
  3. Suggestions required for solving a Java problem
    By bilal_ali_java in forum Advanced Java
    Replies: 3
    Last Post: 08-16-2008, 01:11 AM
  4. JFrame problem
    By vassil_zorev in forum AWT / Swing
    Replies: 1
    Last Post: 01-25-2008, 02:53 AM
  5. JFrame problem
    By saytri in forum New To Java
    Replies: 6
    Last Post: 01-11-2008, 05:12 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