Hello Everyone!!!

Does anyone here knows how to display the content of the database in a JTextArea?

For example....

In mydatabase, I have a column name 'username' and I want to display all the contents of that 'username' in JTextArea..

What shall I do and what classes I need to have in order to perform this..
I hope , you can give me a sourcecode or even sites to where I can learn about this one.

I am currently working in java and mysql database...
YOUR HELP IS HIGHLY APPRECIATED>>>
THANK YOU...

Recommended Answers

All 2 Replies

JTextArea.append()
or you can use setText() of JTextComponent as JTextArea.setText("My String");

And have a class that reads from the database and gets the data you want to display in a String, or an array, or in whatever you want.
You call that class in your gui and display the results like peter_budo said.
As you can a lot of things are involved. Where are you having problems? In reading the database or displaying the gui.
Remember, don't put all in one class. Try to separate functionalities. One class for the DB, one for the GUI. Test both before you start calling one into another

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.