JText fields and Strings

I have a JText field created

final JTextField curProject = new JTextField(20);

I am trying to assign a String value to that field?

curProject = currentProject.getName();

Type mismatch: cannot convert from String to JTextField
jkteaterAsked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
Should be
curProject.setText(currentProject.getName());

Open in new window

0
 
jkteaterAuthor Commented:
should there be a listener?
0
 
for_yanCommented:
CurProject.setText(crrentProject.getName())
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
for_yanCommented:
Istener does not matter for assigning string to setText method
0
 
for_yanCommented:
You cannot asign string to curProject bbecauise curProject is a JTextFiled and not a String, but you shoid use a method setText(String) which takes String as an argument
0
 
for_yanCommented:
And you certainly can varioius listenes assigned to JTextField - like ActionnLustener whochj would listen for carriage return or KeyListener which would fire with any key typed, but this has no connecion to your type mmismatch situatin
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.

All Courses

From novice to tech pro — start learning today.