Bishawjit Dey
,
Greenhorn
Aug 21, 2012 15:18:39
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.
Campbell Ritchie
,
Marshal
staff
Aug 21, 2012 15:27:23
Welcome to the Ranch
What about the toString() method?
Bishawjit Dey
,
Greenhorn
Aug 21, 2012 16:00:25
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().
Ranganathan Kaliyur Mannar
,
Bartender
staff
Aug 22, 2012 01:40:44
No, he is talking about using the toString() method in the Arraylist.
Kemal Sokolovic
,
Bartender
staff
Aug 23, 2012 12:01:08
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