File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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.
I agree. Here's the link:
subject: Why I can't take the string from JTextField?
Similar Threads
For Each LOOP Question
Getting values from textfield
Ignoring spaces/multiple spaces in a txt file (replaceAll method problem)