Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Why I can't take the string from JTextField? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Why I can Watch "Why I can New topic

Why I can't take the string from JTextField?

Richard Phen
Ranch Hand

Joined: Apr 27, 2002
Posts: 52
The code is showed below:

I type in some number and get a blank result: getSeatNumOnButnPan:
Why? Please help me solve it.

John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

protected JTextField seatTf = new JTextField(3);

That's because you used the wrong constructor for the filed. You probably meant:
protected JTextField seatTf = new JTextField("3");
JTextFiled(int value) means something else.
It is sorta covered in the JavaRanch Style Guide.
subject: Why I can't take the string from JTextField?
Similar Threads
For Each LOOP Question
Ignoring spaces/multiple spaces in a txt file (replaceAll method problem)
Getting values from textfield