Image shows what getDisplayMedia()
does
I want to show user, all the current opened applications/windows (like that of alt+tab) using java. In javaScript we can do this by Media Devices interface getDisplayMedia()
. I want to implement similar feature using java.
Is there any way to do this using JNA, or something else.
The method I'm sharing does the trick of pulling up the alt+tab menu using Java Robot and letting it close after a delay (It switches the window as well). Hope this helps!
public static void alt_tab() {
Robot robot;
try {
robot = new Robot();
robot.keyPress(KeyEvent.VK_ALT);
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
robot.delay(5000);
robot.keyRelease(KeyEvent.VK_ALT);
} catch (AWTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Cheers!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With