Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: PROBLEMS WITH LOGIN FORM

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PROBLEMS WITH LOGIN FORM

    Hello guys, i am working on an application that requires a login. The problem is that after logging in with a correct user id and password the login form (LoginGui) is suppose to exit and the main window(MainWindowGui) will appear, but the login form even though it disappears, it still appears imbedded in any other form that later comes up. This is the portion of the code that exits the loginform and calls the main window.



    .
    .
    .
     if (isPasswordCorrect(input)) {
                 setVisible(false);
                     MainWindowGui();
            } else {
                JOptionPane.showMessageDialog(null,
                    "Invalid password. Try again.",
                    "Error Message",
                    JOptionPane.ERROR_MESSAGE);
            }
    .
    .
    .

    kinldy advice


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: PROBLEMS WITH LOGIN FORM

    it still appears imbedded in any other form
    Please explain what happens.
    There isn't enough code posted to say what the program is doing.
    Make a small complete program that compiles, executes and shows the problem.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Sep 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: PROBLEMS WITH LOGIN FORM

    the problem is with how to exit the login form or to cause it to disappear and to display the main application.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: PROBLEMS WITH LOGIN FORM

    What class is the "login form"? Does it have a method that can be called to change its visibility?
    What class is the main application? Does it have a method that can be called to change its visibility?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Sep 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: PROBLEMS WITH LOGIN FORM

    The class for the login form is LoginGui() and that of the main application is MainWindowGui(): they both do not have a method that can be called to change their visibility.

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: PROBLEMS WITH LOGIN FORM

    do not have a method that can be called to change their visibility.
    Strange. How are they made visible if there is no method to call that makes them visible?
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Member
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    54
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Default Re: PROBLEMS WITH LOGIN FORM

    Quote Originally Posted by uijbaba View Post
    The class for the login form is LoginGui() and that of the main application is MainWindowGui(): they both do not have a method that can be called to change their visibility.
    There are a few ways to achieve what you want but without seeing the entire code, it's impossible to know why your program is behaving the way it is. One way is to use 1 JFrame and use a Layout Manager, such as CardLayout. From the sounds of it, each of the 2 windows can ultimately be placed in a JPanel, although you may have multiple levels of layering or JPanels inside of other JPanels depending how your code is set up. Alternatively, you can use separate JFrames where you would create a frame instance (since you cannot add 1 JFrame inside of another, bring up a new window and make the frame visible there.

    Quote Originally Posted by uijbaba View Post
    they both do not have a method that can be called to change their visibility.
    Then how can either be shown?

Similar Threads

  1. How to exit a login form
    By uijbaba in forum AWT / Java Swing
    Replies: 4
    Last Post: October 14th, 2013, 04:17 PM
  2. Problem in a web that uses javascript in his login form
    By kamarilla in forum What's Wrong With My Code?
    Replies: 8
    Last Post: June 1st, 2011, 05:47 PM
  3. Help in Login
    By flyingpapers in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 11th, 2011, 01:43 AM
  4. Login form on webpage
    By rosebabz in forum JDBC & Databases
    Replies: 0
    Last Post: January 14th, 2010, 10:34 AM
  5. Java Swing :Back Button from one form to another form
    By srinivasan_253642 in forum AWT / Java Swing
    Replies: 1
    Last Post: December 26th, 2009, 09:51 AM