requestFocus() Any Component Inside A JSplitPane

To have a component get focus, you just need to call the method requestFocus() and that is it. However in my case, the component is inside a JSplitPane. My left pane contains a JTree and when a tree node is clicked, I want the focus to be transferred to the component in the right pane.

I am not certain if this is a bug or not but calling requestFocus(), grabFocus(), requestFocusInWindow() neither worked. The only workaround left I can think of is to simulate a mouse click since a mouse click was the only way I verified that the focus would be transferred to the component in either panes. Luckily I found a solution in the Java forums made by user delewis.

Related Posts Plugin for WordPress, Blogger...

Post a Comment