Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTextFields not allowing entry?

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jennifer,
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
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic