Brand new to Java, boss insists I learn it, I do alot of vba stuff, so I thought I would give it a go.
I have an access database called javatest.mdb located in c:\
I can connect to the database in the runtime fine, I can even view the data.
Now I have dropped a textbox on my JFrame, how do I display what one of my fields in the database, field names are field1, field2, field3 and field4.
Any examples would be appreciated.
I'm using NetBeans 5.5
Hey buddy, we don't "drop" components onto anything in Java - that is a 'Windows' term, but hey, at least you admit to being a VBA person.
Let me sub_() you into some info:
Well, if you have access to the daat stored in the database, then you can get the information about the database through the same methods - though you didn't say how you did that anyway, I assume JDBC using SQL queries.
You can set the value of text fields using custom code.
Is that what you want, or were you looking for something else?
I think data binding is being added to netbeans 6 next year, otherwise you will have to use JDBC to access the database and call setText for the field with the data you get out of the db (manual coding). Google for the jdbc odbc bridge for accessing Access DB.
For data binding you can use Swing X http://www.swinglabs.org/projects.jsp, as long as you don't mind writing code by hand.
In the mean time, if you really want to do the binding using drag and drop you can use the Visual Web pack for netbeans 5.5 and create a web based app with data binding. If you wait a week or two the final version (preview can be downloaded at the moment) of the web pack should be released.
Sorry about the tone of the other guy's comment, it seems that Java programmers are traditionally hostile towards VB guys and how they view the world ;)
Thanks for the reply.
I have been tinkering with NetBeans 5.5 a bit, I really like it thus far. I am able to get a text field on my form to display a field from one of the records in my database.
I changed gears and am using mysql as my database.
Is there an example somewhere of of how make the buttons to scroll through my record set?
I'm looking forward to learning a new language.
You'll probably have to add an actionListener to the button and write code to populate your controls with the data from the next element in your resultSet. No easy way currently like adding the next/previous buttons in Access/VBA or Delphi.