Results 1 to 11 of 11
  1. #1
    kine is offline Member
    Join Date
    May 2010
    Posts
    7
    Rep Power
    0

    Default Help with Multiple JFrame visiable

    I have difficulties in selecting or making one GUI JFrame visiable and the others invisiable when user login.

    the class are
    login.java
    employee.java
    inventory.java
    sale.java

    now if a user login using the login.java JFrame form to login, which should take the user to one of the java class JFrame e.g employee.java which should be visiable and the others should be invisiable.

    String user = JTextField1.getText();
    String pass = jPasswordField1.getPassword();
    String selectCmbo = (String)jComboBox1.getSelectedItem();

    try
    {
    if(rs.getString("Username").equals(user) && rs.getString("Password").equals(pass)&& rs.getString("designation").equals(selectCmbo))
    {
    employee objeEmp = new employee();
    objEmp.setVisiable(true);
    inventory objInven = new inventory();
    objInven.setVisiable(false);
    sale objSale = new sale();
    objSale.setVisiable(false);
    this.setVisiable(true);
    }
    }

    each time the user login, all these JFrame are visiable. please assist me to make one Jframe visiable when user login and not all at same time.

    hope to get good assistance in this question

  2. #2
    Sno's Avatar
    Sno
    Sno is offline Senior Member
    Join Date
    Apr 2010
    Posts
    196
    Rep Power
    5

    Default

    your are saying 'setVisiable' the correct word is 'setVisible'
    Last edited by Sno; 06-07-2010 at 02:48 PM. Reason: Spelling
    :rolleyes: ~ Sno ~ :rolleyes:
    '-~ B.S. Computer Science ~-'

  3. #3
    kine is offline Member
    Join Date
    May 2010
    Posts
    7
    Rep Power
    0

    Default

    That spelling error and it's taken.
    so what is the correct way of solving this question

  4. #4
    Sno's Avatar
    Sno
    Sno is offline Senior Member
    Join Date
    Apr 2010
    Posts
    196
    Rep Power
    5

    Default

    what do you mean?

    You set false for invisible and true for visible.

    This is what I mean in your code you have setVisiable, its setVisible...

    You also need to pay attention to what you name things, example. you have employee objeEmp, but you set objEmp.setVisiable(true); it needs to be the same objeEmp.setVisible(true);

    Java Code:
    try
    {
    if(rs.getString("Username").equals(user) && rs.getString("Password").equals(pass)&& rs.getString("designation").equals(selectCmbo))
    {
    employee objeEmp = new employee();
    objeEmp.setVisible(true);
    inventory objInven = new inventory();
    objInven.setVisible(false);
    sale objSale = new sale();
    objSale.setVisible(false);
    this.setVisible(true);
    }
    }
    Last edited by Sno; 06-07-2010 at 03:31 PM.
    :rolleyes: ~ Sno ~ :rolleyes:
    '-~ B.S. Computer Science ~-'

  5. #5
    kine is offline Member
    Join Date
    May 2010
    Posts
    7
    Rep Power
    0

    Default

    I think you have missed the importance of assisting members in this forum, that are asking for help or suggestion to their challenges. you capitalize in look for typographical error which doesn't add value to person asking and other member as well.

    if you do have solution or suggestion to the question being ask, it nice to share your knownlegde with others, than to look for little thing that does not add value to the members of this forum.

    may be you will also check my spelling or grammer here.

    Thank you

  6. #6
    StormyWaters is offline Senior Member
    Join Date
    Feb 2009
    Posts
    305
    Rep Power
    6

    Default

    If you don't spell the method names right, they don't work as expected. If that really is your code, then that's the solution. Maybe you should provide us with the part of the actual code you are using, or better yet a SSCCE of the problem you are facing.

  7. #7
    StormyWaters is offline Senior Member
    Join Date
    Feb 2009
    Posts
    305
    Rep Power
    6

    Default

    That whole logic inside the if statement seems wrong to me... Why are you creating local gui variables only to have them be setVisible(false) before you exit the if statement?

  8. #8
    Sno's Avatar
    Sno
    Sno is offline Senior Member
    Join Date
    Apr 2010
    Posts
    196
    Rep Power
    5

    Default

    Quote Originally Posted by kine View Post
    I think you have missed the importance of assisting members in this forum, that are asking for help or suggestion to their challenges. you capitalize in look for typographical error which doesn't add value to person asking and other member as well.

    if you do have solution or suggestion to the question being ask, it nice to share your knownlegde with others, than to look for little thing that does not add value to the members of this forum.

    may be you will also check my spelling or grammer here.

    Thank you
    Wow.. Kine, :( I'm sorry your taking offense to me correcting your spelling on your code in order for the compiler to understand what you wanted to do. My knowledge of the compiler is it understand specific method names, and properties to get the user's result.

    My case is ended, and I know my experience is limited and I am on this forum to help and learn myself.

    My words of advice for the future, take things step by step, and make it simple and things will turn out less complex.
    Last edited by Sno; 06-07-2010 at 10:09 PM. Reason: edited due to I was harsh in my reply...
    :rolleyes: ~ Sno ~ :rolleyes:
    '-~ B.S. Computer Science ~-'

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

    Default

    Quote Originally Posted by Sno View Post
    Wow.. Kine, :( I'm sorry your taking offense to me correcting your spelling on your code in order for the compiler to understand what you wanted to do. My knowledge of the compiler is it understand specific method names, and properties to get the user's result.

    My case is ended, and I know my experience is limited and I am on this forum to help and learn myself.

    My words of advice for the future, take things step by step, and make it simple and things will turn out less complex.
    Kine, programming is an exercise in precision. If you misspell or miscapitalize one word, or have a semicolon out of place a huge program can come crashing down. So any corrections of mispellings of your programs are appropriate and are given in an effort to help you with your project.

    I suggest you either grow a thicker skin or quit programming, and I'm dead serious. You come to this forum for free advice, and Sno has volunteered his free time to give what I consider to be good advice and for his doing this you shoot him down. Not good. I'm not even sure why I'm posting this as I know that you'll try to shoot me down as well. So after this post, I'll make an effort to avoid irritating or trying to help you. Best of luck.
    Last edited by Fubarable; 06-07-2010 at 10:56 PM.

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default

    Another point for the @OP, if he does not copy and paste the source for the program, but types it in from memory then there is a chance that the posted code is not the code with the problem.

  11. #11
    kine is offline Member
    Join Date
    May 2010
    Posts
    7
    Rep Power
    0

    Default

    Thank for your understanding Norm that you showed in my post. the code wasn't copied from my program rather i wrote it out as you have notice from typo-error, seeking for assistance to correct my errors not type-erros but the logic in having solution to my code, which i know makes it not to work as i expected.

    I'm new to programming and i don't intend to pick offence on member comments but i want to continue to pick out good contribution from members, helping others in resolving their question .

Similar Threads

  1. Replies: 5
    Last Post: 11-09-2009, 06:12 PM
  2. MultiPle JFrame problems
    By sysout in forum New To Java
    Replies: 2
    Last Post: 08-26-2009, 03:55 AM
  3. Multiple Panels in JFrame or JPanel
    By DavidG24 in forum AWT / Swing
    Replies: 5
    Last Post: 05-16-2009, 12:47 PM
  4. Replies: 6
    Last Post: 07-28-2008, 06:04 PM
  5. Can't synchronize multiple JPanels in a JFrame
    By vassil_zorev in forum AWT / Swing
    Replies: 0
    Last Post: 12-30-2007, 04:22 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
  •