• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 308
  • Last Modified:

List to textfield

Same type of question

ThreedTrans = (List) currentProject.getThreedTranslatorOptionIds();

cur3dTrans.setText(??);
0
jkteater
Asked:
jkteater
  • 5
  • 4
  • 3
1 Solution
 
CEHJCommented:
You can't expect everyone to be following your every move here ;) More info please (or at least a link). Even i can't remember and i probably answered it ;)
0
 
for_yanCommented:
Do you meant to have all em,lemets in there?

String s = "";
for(int j=0; j<ThreedTrans.size();j++){

s += (String) ThreedTrans.get(j) + ",";
}

cur3dTrans.setText(s); 

Open in new window

0
 
jkteaterAuthor Commented:
Shoot I thought you guys where following my every thought pattern and question :)
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
CEHJCommented:
If it's a java.util.List subclass:
cur3dTrans.setText(ThreedTrans.toString());

Open in new window

0
 
jkteaterAuthor Commented:
ThreedTrans = (List) currentProject.getThreedTranslatorOptionIds();

the above is getting a List of values.  In my dialog I have a panel with the following

3d Translator:   [text field (cur3dTrans)]  [button]

I need to display the values of the list in my textfield.  You may say don't use a textfield, but I need for the users to be able to cut from the field
0
 
CEHJCommented:
>>If it's a java.util.List subclass:

Is it?
0
 
jkteaterAuthor Commented:
Why is it when it displays it puts brackets around the values

[DWG, IGES]
instead of

DWG, IGES
0
 
jkteaterAuthor Commented:
it is actually a ArrayList so I do have java.util.ArrayList
0
 
for_yanCommented:
Taht's how list.toString() works - with baracklets
Either use something like my code above - or strip away fiorst
and last charcater from toString()
0
 
for_yanCommented:

It does not matter - toString() for Lits or ArrayList works the same
0
 
CEHJCommented:
If you're lazy (i am)
cur3dTrans.setText(ThreedTrans.toString().replaceAll("^\\[|\\]$", ""));

Open in new window

0
 
CEHJCommented:
:)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now