Forums Register Login

Printing the contents of arraylist in JTextArea

+Pie Number of slices to send: Send
I have an arraylist of string type and I want to print the contents of that arraylist in a jtextarea using its settext method. but jTextArea only accepts string Objects.
+Pie Number of slices to send: Send
Welcome to the Ranch
What about the toString() method?
+Pie Number of slices to send: Send
thank you

I have my arraylist in a separate class from the gui class and I am trying to set the text in Jtextarea with a method. kind of like this

JTextArea txt = new JTextArea();

txt.setText(cal.returnArray());

returnArray is a method which will return a few variables packed in an ArrayList of string type

I am confused as how I can typecast a method to toString().
+Pie Number of slices to send: Send
No, he is talking about using the toString() method in the Arraylist.
+Pie Number of slices to send: Send
Something like this should do the work:
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 8493 times.
Similar Threads
Insertion in JTextArea
display contents of a text file in a new window
How do you set the color of an array List of JTextArea
Printing from JTextArea
JTextArea size increase as size of font increase
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 19:24:00.