Results 1 to 3 of 3
  1. #1
    HosHos's Avatar
    HosHos is offline Member
    Join Date
    Aug 2009
    Posts
    10
    Rep Power
    0

    Thumbs up (Solved)switching from frame to another

    HI everyone,
    This is my first thread,i hope its good
    This is the solution for a problem i faced for the last few days , the problem was switching from frame to anotherfor any purpose ,for example login username and password,and then login.

    The Solution:

    1)We create the frames starting with the first one we want to apear.
    2)Then add event for clicking the button of login to hide the first frame and show the next frame using this command.
    3)Write this code there

    private void jbutton action performed (java.awt.event.actionevent evt){
    this.setVisible(false); //hide the first frame -contaning the button-
    new "the name of the next frame" ().setVisible(true); //show the next one

    }

    4)This wil do the job. //I tried it myself

    I hope i've done well .

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

    Default

    I suggest that you don't do it this way, that you use a CardLayout to swap JPanels instead.

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

    Default

    Quote Originally Posted by HosHos
    i wann tell u that i'm still sudying Java SE course.
    and i don't know about layout.
    But i can learn about ,do u suggest certain reference or tutorials .
    Thanks in advance
    You bet. Please look here:
    Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI with JFC/Swing)
    How to Use CardLayout (The Java™ Tutorials > Creating a GUI with JFC/Swing > Laying Out Components Within a Container)

    Much luck with your studies!

Similar Threads

  1. Replies: 4
    Last Post: 01-31-2009, 06:29 AM
  2. Replies: 13
    Last Post: 10-21-2008, 03:32 PM
  3. [SOLVED] Activation Frame
    By Mir in forum New To Java
    Replies: 34
    Last Post: 07-22-2008, 10:45 AM
  4. switching packages
    By DuceDuceExplorer in forum NetBeans
    Replies: 4
    Last Post: 07-10-2008, 12:11 AM
  5. [SOLVED] How to set the frame size?
    By impact in forum New To Java
    Replies: 7
    Last Post: 05-02-2008, 12:57 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
  •