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

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
0
jkteater
Asked:
jkteater
  • 4
  • 2
1 Solution
 
jkteaterAuthor Commented:
should there be a listener?
0
 
CEHJCommented:
Should be
curProject.setText(currentProject.getName());

Open in new window

0
 
for_yanCommented:
CurProject.setText(crrentProject.getName())
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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