Hi, I wrote 2 classes: mainframe.java and submitactionlistener.java. The mainframe class implements a frame and contains some swing components, including a submit button. If the button is clicked, a method should run, getting values from a JComboBox and a JTextField and save this stuff in the database. But I don't know how to handle this. The ActionListener works fine, but I couldn't find a way reading out the values and safe them ... any help?
Maybe, you may try declaring your components as private static. And implementing some getter and setter. e.g:
This way, you may get and set your JTextField whenever you want in your SubmitActionListener, simply like this
I hope it was what you wanted
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
Joined: Jan 13, 2002
Oups, sorry, I didn't see that you wanted to save it in a database. For this, you should open a connection to your database. Create a query with the values that you retrieved from the JTextField and then execute the query. For that you should make a quick search in the jdbc forum I hope it helps
Joined: Mar 25, 2003
I hope it helps
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com