JGUII (java graphical user interface interaction) is a java library which allows the developer to open, close and focus windows and produce dummy keyboard and mouse input in an X11 environment. Because of its design this can be accomplished using very simple code.
Details on using/setting up JGUII can be found in the [wiki.] (https://github.com/jackoconnor/JGUII/wiki)