Results 1 to 2 of 2
  1. #1
    kbyrne is offline Member
    Join Date
    Dec 2007
    Posts
    15
    Rep Power
    0

    Default Adding and removing panels dynamically

    Hi,

    Apologies if this has already been answered, I looked back a few pages and didn't see anything on the topic.

    I'm developing a system, in which the initial page allows a user to log on with username and password leading them to another screen. There are many ways to do this, i believe:

    1. Set current JFrame to Invisible and create a new one
    2. Set the current panel with login details to invisible and set the desired swing components within the panels you want to show to visible.
    3. Remove the current panel and add in the necessary panels when logged in.

    I'm guessing 3 is the best option but i don't know how to remove and add JPanels as necessary. If the code i have helps, I can upload. If this question has been asked before, please redirect me. Any advise would be helpful.

    Thanks

  2. #2
    Java Tip's Avatar
    Java Tip is offline Moderator
    Join Date
    Nov 2007
    Posts
    1,694
    Blog Entries
    430
    Rep Power
    9

    Default

    Swing containers should have add and remove methods. You already know how to call add..

    But for your purpose, it looks like a wizard framework is best option for you. With these frameworks you can create wizards similar to installation wizard of programs.

    Check this document for further details:

    java.net: Using the Wizard API
    "The sole cause of manís unhappiness is that he does not know how to stay quietly in his room." - Blaise Pascal

Similar Threads

  1. images, panels and applets
    By jamesfrize in forum Java Applets
    Replies: 3
    Last Post: 03-20-2008, 04:35 PM
  2. Buttons to show new panels
    By Lehane_9 in forum AWT / Swing
    Replies: 1
    Last Post: 03-06-2008, 04:22 PM
  3. Working with Labels on Panels.
    By vargihate in forum AWT / Swing
    Replies: 2
    Last Post: 01-04-2008, 04:09 AM
  4. JMenu calling another Forms/Panels
    By plodos in forum New To Java
    Replies: 2
    Last Post: 12-10-2007, 08:02 AM
  5. Need a tutorial for Studying about Panels
    By ramachandran in forum New To Java
    Replies: 1
    Last Post: 10-25-2007, 09:05 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
  •