Java eclipse help.

Informant

Senior Member
Joined
Dec 18, 2015
Messages
1,390
Reaction score
620
Basically im able to register and login to the new JPanel with a "Welcome, "Name" ". How do i replace my hardcoded Name from the user logon with the username? My lecturer said that i need to modify the constructor and the login.java and the new Frame im able to display the username already. after a number of research i still couldn't get it. i wonder if anybody able to assist me.
 

BlackCube

Great Supremacy Member
Joined
Jul 18, 2003
Messages
71,252
Reaction score
861
Post your code here where you think the problem lies. Wrap with [ code ] tag.

Then ask your question again.
 

BlackCube

Great Supremacy Member
Joined
Jul 18, 2003
Messages
71,252
Reaction score
861
If I get your question correctly, then you need to pass in the UserData object to your Summary class then you'll be able to access the data.

For example:

PHP:
public Summary(JFrame af, UserData uData) {
    JLabel label = new JLabel ("Welcome " + uData.getUsername());
}

If you don't understand then you have to do more research. This should help you to proceed.
 

Informant

Senior Member
Joined
Dec 18, 2015
Messages
1,390
Reaction score
620
Thank you for your help. That's what i mean for the question. appreciate your kindness. i wonder if you able to help me out with my another code.? just a minor one.
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,301
Okay, so what i'm trying to do is, when i click on setting. it will go to my settings panel. the information just display accordingly. But when i go back to summary panel, the name just literally disappeared. When i click back the settings the information has also disappear after retrieving..

...

It will be not possible to help you trace your code since you have only posted partial codes. I will guide you to find your problem, not look at your codes and help you debug.

Before you enter your Settings and Summary Panel in the respective constructors, print out into STDOUT and find out the values inside the UserData object. It will help you to trace certain logic flows in your constructors.

You will also need to answer if your Settings and Summary Panels are created each time they are displayed or set to be visible. Remember your constructors are only involved each time the object is instantiated, not every time it is drawn on the screen.

I will also recommend you to rename your MainPanel as BasePanel, or AbstractPanel because these conventions denote the hierarchical modelling. MainPanel is more likely interpreted as you have a main dashboard UI somewhere when your program starts.
 

Informant

Senior Member
Joined
Dec 18, 2015
Messages
1,390
Reaction score
620
Hi david, thanks for the help. i have another issue which is. I'm able to update my password through client side effect. But why the password change effect does not reflect to my database?
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,301
Hi david, thanks for the help. i have another issue which is. I'm able to update my password through client side effect. But why the password change effect does not reflect to my database?

Did you commit your database update ? Is your connection set on auto commit or not ? You need to verify that. Did your update statement update the right row too ? You will want to turn on query logging on your database to set what your database executed.
 

Informant

Senior Member
Joined
Dec 18, 2015
Messages
1,390
Reaction score
620
Did you commit your database update ? Is your connection set on auto commit or not ? You need to verify that. Did your update statement update the right row too ? You will want to turn on query logging on your database to set what your database executed.

What do you mean by commit database update? I've check my connect is set to auto commit. The statement i've check is clearly is in the right row. How do i turn on my query logging on? im using mySQL workbench. Also, can you check out with my code on post #7? Thanks
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,301
What do you mean by commit database update? I've check my connect is set to auto commit. The statement i've check is clearly is in the right row. How do i turn on my query logging on? im using mySQL workbench. Also, can you check out with my code on post #7? Thanks

https://dev.mysql.com/doc/refman/5.7/en/query-log.html

I have already read your code, but it is not indicative for issues since I can't decide what query is executed on runtime and what your database table data are.

You will need to do your debugging yourself.
 

Informant

Senior Member
Joined
Dec 18, 2015
Messages
1,390
Reaction score
620
The issue has been resolved. There's no issue with my database. The problem lies at swing app.
 

BlackCube

Great Supremacy Member
Joined
Jul 18, 2003
Messages
71,252
Reaction score
861
It will be great for you to list your problem and how your resolve it. So others that are reading can also benefit from it as well.

You do not need to post your entire code, but a partial one to describe the issue and how you overcome it.
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top