2
Contributors
7
Replies
10
Views
8 Years
Discussion Span
Last Post by stultuske
0

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

0

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?

0

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?

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

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

0

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 :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.