How to simulate Ctrl + Shift + f1 in a swing application and write to a log file

I have this swing client client server application.

I want to simulate the effect of " Ctrl + Shift + f1 " and write to the log4j log file for specific frames that I load for debugging purposes. Is there any rotation method that I call to enable this option? How to do it?

Or is there a better way to find out the layout while it is being loaded and written to the log file?

Thank.

+3
source share
1 answer

You can easily simulate keystrokes using the Robot class, it has methods to press and release keys .

Robot r = new Robot();
r.keyPress(KeyEvent.VK_CONTROL);
r.keyPress(KeyEvent.VK_SHIFT);
r.keyPress(KeyEvent.VK_F1);
r.keyRelease(KeyEvent.VK_F1);
r.keyRelease(KeyEvent.VK_SHIFT);
r.keyRelease(KeyEvent.VK_CONTROL);
+6
source

All Articles