This week's giveaway is in the Beginning Java forum.
We're giving away four copies of Bad Programming Practices 101 (e-book) and have Karl Beecher on-line!
See this thread for details.
Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Move focus from specific jcombobox to specific jtextarea  RSS feed

 
Greenhorn
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
 
Rancher
Posts: 2911
18
  • 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: http://stackoverflow.com/questions/26762811/move-focus-from-specific-jcombobox-to-specific-jtextarea

It is annoying to spend the time answering a question only to find the question has been answered on another forum already
 
I have gone to look for myself. If I should return before I get back, keep me here with this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!