| Author |
getting jTextField input
|
Ah Ling
Greenhorn
Joined: Dec 28, 2009
Posts: 12
|
|
Good day to all!
I met one problem while doing my project.
I have two classes.
One class is like a form which will take in input from the user using jTextField.
Another class is like a summary which will display what the user had entered in the form.
Can I display the input entered in the form at my latter class in jLabel or jTextField?
I tried the methods that I have found online but it does not help.
Any kind soul can provide me a simple example? I'll try to figure it myself.
|
 |
Ah Ling
Greenhorn
Joined: Dec 28, 2009
Posts: 12
|
|
Hey!
So sorry for your time!
I have got it right already!
Thanks!!!
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8436
|
|
glitter Air wrote:
Welcome to the Ranch.
Please check your private messages for an important administrative matter
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
Piyush Patel
Ranch Hand
Joined: Feb 24, 2009
Posts: 127
|
|
create static mathod that returns jTextField value . (make JTextField Object Static as well) .
then call,
String val=ClassName.getJTextFieldVal();
which gives you uour jTextField value in Another class.
|
[My Blog] [ Follow @Twitter] | Innovations never goes out of Style...
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Yeah, don't. Static component fields are just about never a good idea. Instead, make it an instance field, make the method non-static and just use a reference to an existing object to call the method on.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Ah Ling
Greenhorn
Joined: Dec 28, 2009
Posts: 12
|
|
Ok thanks peeps!
Problem solved already!
|
 |
 |
|
|
subject: getting jTextField input
|
|
|