Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Swing / AWT / SWT and the fly likes JTextFields not allowing entry? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextFields not allowing entry?" Watch "JTextFields not allowing entry?" New topic

JTextFields not allowing entry?

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Hi. I am having a hard time figuring out something. When I run my application, and bring in information from the AS400, I want to key some text into one of my text fields. The problem is, whenever I try to key something, nothing shows up. The only way I can key into a field is if I hold down the delete key, or highlight the field and hit delete once. All of my fields have a certain length specified for them. It's kind of acting like it is going directly to the end of the field when the information comes in. How can I fix this?
Thanks in advance!
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Are you creating your JTextField with default text and length?
new JTextField(" ", 5) If you are filling the field with spaces, just remove that from your code. If not, please provide a code snippet. The default for a JTextField is to go to the end of the text. You should be able to type in beyond the visible area though.
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Thanks for the reply Paul. Here is how I am setting the text for my fields:

I am using Visual Age for Java 3.5.3 for this application, and all of my JTextField properties have different lengths specified for them.
Thanks again for any help!
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Hello. Anyone have any ideas? Let me explain this a little better. Oh, and the code I pasted above, not the right code. Sorry! I am using I guess what you would call a template for all of my text fields. This template allows me to specify a certain length for each field I insert. I just can't seem to figure out how to make it go to the beginning of the text field when the information is brought in. Here is the code for my "template":

If anyone could please help me figure out what I did wrong, I would be forever grateful!
Thanks a bunch!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: JTextFields not allowing entry?
Similar Threads
Data mapping problems ?
text filed and button validation
Mock Exam, Page 370, Question 13, C
Acheiving Focus using EnterKey
Can I pass JTextField as parameter?