#Java Login Form

33 messages ยท Page 1 of 1 (latest)

brisk coyote
unkempt rampartBOT
#

โŒ› This post has been reserved for your question.

Hey @brisk coyote! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

keen gulch
#

You should only have 1 main method, only one of them runs when starting the program. If the program starts by running the main method in Main.java, logininfo will get set, but the GUI won't show. If the program starts from the main method in LoginFormDemo.java, then the GUI shows, but logininfo stays empty.

brisk coyote
#

I tried putting these:

IDandPasswords idandPasswords = new IDandPasswords();
LoginFormDemo loginPage = new LoginFormDemo(idandPasswords.getLoginInfo());

into LoginFormDemo and deleted the main class, still the button didn't worked.

Or rather I'm doing not right?

keen gulch
#

If you only pasted those lines in, loginPage is never used, and frame is instead.
Are you familiar with OOP? Each object of the same class can have different data, in other words, the value of logininfo will be set inside of loginPage, but it will be empty inside of frame

brisk coyote
#

Yes I am familiar, but it's too much for me to remember all the things I studied that's why I'm having this trouble.

keen gulch
#

I feel you, it takes a while to get down.

brisk coyote
#

Like ,I know the things that I studied. But when I'm going to apply them to the actual thing my mind goes blank.

keen gulch
#

I think for me, applying information is probably the quickest way to learn it

brisk coyote
#

I agree, I also learned something in java swing the first time I used it few days ago while making this log in form.

#

And still can't figure out how can I make the button work.

keen gulch
#

can you share your main method?

brisk coyote
#

Which one? from the main class or the LoginFormDemo?

#

The first one is for the LoginFormDemo

keen gulch
brisk coyote
#

Yeah, but they are on a separate class and tried to remove the main class on the 'Main.class'

#

that's what I've been trying to do earlier

#

Already tried removing the main in the main.java

brisk coyote
#

There's nothing wrong with my button's function right?

keen gulch
#

I see.
The button will work, though it won't display anything if an incorrect username is inputted.

#

Provided that logininfo is set

brisk coyote
#

This is my main method now, pfff

keen gulch
#

why are you making 2 LoginFormDemo objects?

#

The constructor video gives a good OOP example

brisk coyote
keen gulch
#

well, inside the frame object, logininfo is empty, then the frame object displays from frame.setVisible(true);

brisk coyote
#

I guess I'm good for now, I'll take a rest. Thank you for your assistance. ๐Ÿ™‚ I'm closing this thread.

unkempt rampartBOT