• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Focus on textbox

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys
I want the cursor to be on a specific textbox when my
applet loads.How do I do that ??
Also, can I set the focus on a text box on generation of some event
Thanx in anticipation
Anurag

 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
anuragbhalla,
Sure... just use the requestFocus() method of Component( which TextBox(?!?!) (I assume you mean TextField or TextArea.) inherits from.) You can do this when you first display it, or in response to an event... Just remember, as the API doc on this method states, "The component must be visible on the screen for this request to be granted."
HTH,
-Nate
P.S. - Some people on here might bug you about this, too... But JavaRanch's naming policy states that you have to have a name with a space in it... Not being picky... it is just the rule...
reply
    Bookmark Topic Watch Topic
  • New Topic