This week's book giveaway is in the Web Services forum.
We're giving away four copies of Microservices in Action and have Morgan Bruce & Paulo A. Pereira on-line!
See this thread for details.
Win a copy of Microservices in Action this week in the Web Services forum!
  • 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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!