Hi all,
I need to switch the focus from my JFrame to another running non-java application window (say Powerpoint) programmatically.
I have used the java.awt.Robot class to simulate the key presses to shift focus using
robot.keyPress(KeyEvent.VK_META);
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_META);
But, this doesn't work when I click on any other application than the desired application, before invoking the focus toggling.
Is there any way I can shift focus to any desired application window. My program runs on a Mac.
Any thoughts on this is greatly appreciated.
I need to switch the focus from my JFrame to another running non-java application window (say Powerpoint) programmatically.
I have used the java.awt.Robot class to simulate the key presses to shift focus using
robot.keyPress(KeyEvent.VK_META);
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_META);
But, this doesn't work when I click on any other application than the desired application, before invoking the focus toggling.
Is there any way I can shift focus to any desired application window. My program runs on a Mac.
Any thoughts on this is greatly appreciated.