#Java Login Form
33 messages ยท Page 1 of 1 (latest)
โ This post has been reserved for your question.
Hey @brisk coyote! Please use
/closeor theClose Postbutton 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.
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.
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?
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
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.
I feel you, it takes a while to get down.
Like ,I know the things that I studied. But when I'm going to apply them to the actual thing my mind goes blank.
I think for me, applying information is probably the quickest way to learn it
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.
can you share your main method?
Which one? from the main class or the LoginFormDemo?
The first one is for the LoginFormDemo
did you understand what I wrote in this message? The whole project should only have 1 main method.
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
There's nothing wrong with my button's function right?
I see.
The button will work, though it won't display anything if an incorrect username is inputted.
Provided that logininfo is set
This is my main method now, pfff
why are you making 2 LoginFormDemo objects?
These vids might help to understand oop better:
https://www.youtube.com/watch?v=kd3dr39rgrk
https://www.youtube.com/watch?v=lhf8gaUx4yU
Java object oriented programming tutorial for beginners
#java #object #oriented #programming #tutorial #beginners
Java constructor constructors tutorial explained for beginners
#Java #constructor #constructors
The constructor video gives a good OOP example
This one is pre-coded, the 2 at the bottom I just pasted it from the java.main
well, inside the frame object, logininfo is empty, then the frame object displays from frame.setVisible(true);
I guess I'm good for now, I'll take a rest. Thank you for your assistance. ๐ I'm closing this thread.
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.