Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

JTextField problem  RSS feed

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my swing interface I have a jtextfield where user can give his input. how do i do this?
i tried setEditable(true). but it is not working. i'm executing this on solaris. is it necessary to add a listener to jtextfield for getting input from user?
any help on this?
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need more information. What isn't working? The user can't type in the field? You can't get the informatin out?
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Don,
You will have to add an actionListener to an button, say "OK" button.
And on its clicked event, you will have to do a .getText method for that textfield.
You can refer my post "How to validate text field". I had a problem of validating the input in the textfield. It isnt solved still.
But in that post you will get the corresponding code, which I think might help you.
Let us know how it goes.
Thanks
Mandar
 
Don Bosco
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,
the problem is - user cannot type in the textfield. i used setEditable(true). but still i cannot see the cursor in the textfield.

 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post your code. There has to be something simple causing this. You aren't putting it on a disabled component are you?
 
Don Bosco
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul,
you are right. I was using these two lines for my JFrame.
setFocusCycleRoot(false);
setFocusableWindowState(false);
Got it now. Thanks Dude.
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought it had to be something like that.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!