JLabel reference [message #256531] |
Fri, 16 May 2008 15:32  |
Eclipse User |
|
|
|
Originally posted by: web02.comcast.net
I am a newby to VEP. I got it loaded finally and to play, I added a
jButton and a jLabel to the default pane then created a button click event.
The code and some of the auto generated mouse clicked code looks like:
// Globals
private JPanel jContentPane = null;
private JButton jButton = null;
private JLabel jLabel = null;
.
.
.
// Buried in method private "JButton getJButton()"
public void mouseClicked(java.awt.event.MouseEvent e) {
System.out.println("mouseClicked()"); // TODO Auto-generated Event stub
mouseClicked()
jLabel.text="XXX"; // <-- MY CODE
}
If I try to reference jLabel.text in this method I get an error stating
"jLabel.texr is not visible".
Can someone explain what is happening here. I do not see a scope problem,
but obviously something is happening that I don't understand.
Thanx,
Bill
|
|
|
|
|
|
|
Re: JLabel reference [message #256561 is a reply to message #256539] |
Fri, 16 May 2008 17:59  |
Eclipse User |
|
|
|
setText is not a field. it's a method. You need the parens. It's a Java
thing.
jLabel.setText("Hello there");
HTH,
Wayne
On Fri, 2008-05-16 at 20:53 +0000, web wrote:
> Thanks, I tried it and that error went away. Now, I am getting:
>
> jLabel.setText cannot be resolved or is not a field.
>
> The variable is the correct name. It appears to be in scope.
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.38960 seconds