Results 1 to 11 of 11
- 06-07-2010, 02:19 PM #1
Member
- Join Date
- May 2010
- Posts
- 7
- Rep Power
- 0
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
- 06-07-2010, 02:47 PM #2
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 ~-'
- 06-07-2010, 03:05 PM #3
Member
- Join Date
- May 2010
- Posts
- 7
- Rep Power
- 0
That spelling error and it's taken.
so what is the correct way of solving this question
- 06-07-2010, 03:29 PM #4
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 ~-'
- 06-07-2010, 09:32 PM #5
Member
- Join Date
- May 2010
- Posts
- 7
- Rep Power
- 0
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
- 06-07-2010, 09:36 PM #6
Senior Member
- Join Date
- Feb 2009
- Posts
- 303
- Rep Power
- 5
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.
- 06-07-2010, 09:42 PM #7
Senior Member
- Join Date
- Feb 2009
- Posts
- 303
- Rep Power
- 5
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?
- 06-07-2010, 10:00 PM #8
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 ~-'
-
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.
- 06-07-2010, 10:53 PM #10
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.
- 06-08-2010, 02:21 PM #11
Member
- Join Date
- May 2010
- Posts
- 7
- Rep Power
- 0
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
-
GridBagLayout and multiple JPanel's on a single JFrame
By Cybex in forum AWT / SwingReplies: 5Last Post: 11-09-2009, 06:12 PM -
MultiPle JFrame problems
By sysout in forum New To JavaReplies: 2Last Post: 08-26-2009, 03:55 AM -
Multiple Panels in JFrame or JPanel
By DavidG24 in forum AWT / SwingReplies: 5Last Post: 05-16-2009, 12:47 PM -
Adding Multiple Panels and Single Scroll bar on the JFrame
By SANDY_INDIA in forum AWT / SwingReplies: 6Last Post: 07-28-2008, 06:04 PM -
Can't synchronize multiple JPanels in a JFrame
By vassil_zorev in forum AWT / SwingReplies: 0Last Post: 12-30-2007, 04:22 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks