Solved

JText fields and Strings

Posted on 2011-09-30
7
267 Views
Last Modified: 2012-05-12
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
Comment
Question by:jkteater
  • 4
  • 2
7 Comments
 

Author Comment

by:jkteater
ID: 36892162
should there be a listener?
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 50 total points
ID: 36892167
Should be
curProject.setText(currentProject.getName());

Open in new window

0
 
LVL 47

Expert Comment

by:for_yan
ID: 36892175
CurProject.setText(crrentProject.getName())
0
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 47

Expert Comment

by:for_yan
ID: 36892180
Istener does not matter for assigning string to setText method
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36892190
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
 
LVL 47

Expert Comment

by:for_yan
ID: 36892209
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 36892481
:)
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
rhino JavaScript import, load 25 85
replace a word with other 1 44
java jdbc batch example 8 35
going to wrong jsp page 2 22
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question