1.11M Members

To set the JTextField value..

 
0
 

Is it possible to set the value of a JTextfield in a class in which the textfield is not declared or created..??

How can one do that??

 
0
 

Is it possible to set the value of a JTextfield in a class in which the textfield is not declared or created..??

How can one do that??

I would imagine it would depend on whether the JTextfield was declared as a public or private class member. If it was declared public, you could set the value directly from another class. If it was declared private, you would have to set it through a public function of the class that created the JTextfield.

 
0
 

I am unable to use any access specifier for the JTextField..

Also the public function of the class containing the JTextField isnot very helpful in accessing the JTextField...(probably because I have declared the class as abstract)...

What can I do in such a scenario..??

 
0
 

I was looking at your code in your other post. In situations like these, I always (at least temporarily) get rid of the "static" and "abstract" qualifiers and see if things work better without them. I also notice that you have two tri () functions. For debugging purposes, I usually put some code in each function to display where I am to the console screen, just to make sure that the function that I think I am calling is really the one I am calling. If it works without the "abstract" and "static" qualifiers, but not with them, that narrows down your problem. If you discover that it makes no difference, that also narrows it down.

 
0
 

Tried doing what you said i.e removing the "abstract" and "static" qualifiers..

But they are requisite for the program to run..
N of course I have tried the console thing..It works properly there in but doesnt give me the required output in the JTextField..

Actually I retrieve the values after every 1000 nanoseconds and want to update the JTextField with those values...

I was trying my hand and it was possible for me to access the JTextField from the other class.. but it does not set the value correctly..What can be the possible error??

 
0
 

Do you have a main class? Maybe I can try it out. Have you attached all the code? How much more is there? Also, you might want to throw up a link to the other thread so people know where the code is.

 
0
 

have sent it as an attachment...

but it is very big...

just see if you could help...

 
0
 

It is not getting uploaded..
Sorry..

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article