Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Move focus from specific jcombobox to specific jtextarea  RSS feed

Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

How do I move focus from a jcombobox to a specific component say a jtextarea.

My attempt below seems to be moving to a random component not the desired jtextarea.

I applied the above logic to move focus from a specific jtextarea to another jtextarea as seen below and it works as desired.

Any help is appreciated
Posts: 2990
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In general Swing manages the tab key and move the focus from the current component to the next component.

However, some components, like a JTextArea and JTextPane and JTable, disable the default functionality of the tab key because the component handles the tab key. In the case of JTable the tab key move the focus from cell to cell. In the text components a tab character is added to the Document of the text component.

Read the section from the Swing tutorial on The Focus Subsystem for more information.

Quit crossposting:

It is annoying to spend the time answering a question only to find the question has been answered on another forum already
That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!