I am hoping someone can help me. I have trawled through the internet for hours and hours now trying to find a solution to this simple problem and for some reason I cannot find anything that can remotely help. So what I am I trying to do I hear you ask? well its simple:
*****Display information from a database in a custom made GUI *****
I have already created one class that has all the elements of the GUI and a second class that has all the database elements.
When I run the database class (using the instance in the GUI class) all information is shown on screen, exactly in the order that I have it instructed to. This is perfect.
When I run my GUI class, my GUI appears, all my text buttons and labels are fine. This is also perfect.
However my question is this, and this is what I have been looking for for ages now: How do I connect the two together?
How do I make it that the column information in the DB matches the textfield information? How do I make it that the column ‘name’ in my MySQL database shows up in the name texfield in my GUI.
For the rest of the project I am sorted. I know how to create ActionListeners to add/remove, go back/forth etc, its just this little part is holding the whole thing up.
I will continue my research
The code is shown below, if you need it. Just keep an eye out for the Dutch
I have used this before. I thought it was just for getting what types of data where in columns (amoungst other things)
Joined: May 04, 2010
I have done some more research and I found something that might be useful but I am not sure where it is supposed to go.
I know I have to bring in the value of the column from the MySQL database. When I usually want to bring in something to a textfield, I use this command:
So now I have created this code:
The only problem I have now is, where do I put this?
I was thinking of making a method called:
And putting in all the colums and corresponding textfields that I need. The problem is that if I put it into the GUI class, it cannot see the resultset variable...
and If I put it in the database class it wont see the textfield variables.