jkteater
asked on
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
CurProject.setText(crrentP roject.get Name())
Istener does not matter for assigning string to setText method
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
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
:)
ASKER