• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Focus on textbox

Posts: 16
  • Mark post as helpful
  • send pies
  • 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

Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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."
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...
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic