RSS Forums RSS

Login Successful, close Login file and Open another file

Please support our Java advertiser: Programming Forums
Reply
Posts: 192
Reputation: tanha is an unknown quantity at this point 
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Login Successful, close Login file and Open another file

  #1  
Sep 15th, 2008
Hi.
I have a LoginForm.java, and then when the user enter the right username and password, then another file called "DictionaryForm.java" opens and the LoginForm.java, closes. How can I do that ???

see the LoginForm.java:
http://www.daniweb.com/forums/thread119702-2.html
AddThis Social Bookmark Button
Reply With Quote  
Posts: 705
Reputation: stultuske is a jewel in the rough stultuske is a jewel in the rough stultuske is a jewel in the rough 
Solved Threads: 83
stultuske's Avatar
stultuske stultuske is offline Offline
Master Poster

Re: Login Successful, close Login file and Open another file

  #2  
Sep 16th, 2008
what do you mean by: the LoginForm.java closes? do you mean that it's a JFrame that you want to disappear?
in that case, use eiter the hide() or dispose() method for the LoginForm frame, and show the new one
Reply With Quote  
Posts: 192
Reputation: tanha is an unknown quantity at this point 
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Re: Login Successful, close Login file and Open another file

  #3  
Sep 16th, 2008
As I put the link, I have the LoginForm.java, which is not directly JFrame, but at the runtime, it creates a Form and asking for username and password,

and then I create a new Jframe Form, and named it DictionaryForm.java.

and in the LoginForm.java, if the username and password is correct it display a message, but I need it displays the DictionaryForm.java instead, and also the LoginForm.java should be closed.

I dont know what to do?
Reply With Quote  
Posts: 705
Reputation: stultuske is a jewel in the rough stultuske is a jewel in the rough stultuske is a jewel in the rough 
Solved Threads: 83
stultuske's Avatar
stultuske stultuske is offline Offline
Master Poster

Re: Login Successful, close Login file and Open another file

  #4  
Sep 17th, 2008
Originally Posted by tanha View Post
As I put the link, I have the LoginForm.java, which is not directly JFrame, but at the runtime, it creates a Form and asking for username and password,

and then I create a new Jframe Form, and named it DictionaryForm.java.

and in the LoginForm.java, if the username and password is correct it display a message, but I need it displays the DictionaryForm.java instead, and also the LoginForm.java should be closed.

I dont know what to do?


Originally Posted by earlierPost
public class LoginForm extends JFrame
sure looks like a JFrame to me ..

what you can do (and I'm not saying it's the most elegant or efficiƫnt way, just got to work here )


in the LoginForm.java, you add the line
  1. this.dispose();

to that part of the if-structure where the login succeeds

on the place where you call the loginFrame, you check wether or not it is still "active", or "visible", or you place a trigger in your LoginFrame.java, right before the dispose(), and after this checks out, you call the DictionaryForm
Reply With Quote  
Posts: 192
Reputation: tanha is an unknown quantity at this point 
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Re: Login Successful, close Login file and Open another file

  #5  
Sep 17th, 2008
Thanks for the reply.
Here I attached the source.
Attached Files
File Type: zip src.zip (5.4 KB, 22 views)
Reply With Quote  
Posts: 705
Reputation: stultuske is a jewel in the rough stultuske is a jewel in the rough stultuske is a jewel in the rough 
Solved Threads: 83
stultuske's Avatar
stultuske stultuske is offline Offline
Master Poster

Re: Login Successful, close Login file and Open another file

  #6  
Sep 17th, 2008
well ... first tip, LoginForm is not supposed to be or contain your main method, it's a tool that's to be used, nothing more.

just put the main method in a new class and use that to call the LoginForm and the DictionaryForm.

when you've done that, re-read the posts above and put those thoughts into a bit of code.
for what I can see in the code you attached, you haven't tried to code it yet, so it's nothing but natural that it doesn't work yet
Reply With Quote  
Posts: 192
Reputation: tanha is an unknown quantity at this point 
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Re: Login Successful, close Login file and Open another file

  #7  
Sep 17th, 2008
thanks very much,
it is working well now.
Reply With Quote  
Posts: 705
Reputation: stultuske is a jewel in the rough stultuske is a jewel in the rough stultuske is a jewel in the rough 
Solved Threads: 83
stultuske's Avatar
stultuske stultuske is offline Offline
Master Poster

Re: Login Successful, close Login file and Open another file

  #8  
Sep 18th, 2008
if it works, mark the thread as solved, it makes it easier to see which problems still need solving
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Views: 1147 | Replies: 7 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:17 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC