JNA + WinAPI will help you, I will give an example of how to make a window on top of all windows. In this example, I'm working with the running Windows Calculator application. You can get the window handle in any other way convenient for you.
package test.jna; import com.sun.jna.Native; import com.sun.jna.platform.win32.User32; import com.sun.jna.platform.win32.WinDef.HWND; import com.sun.jna.win32.W32APIOptions; public class testjna { public interface MyUser32 extends User32 { static final MyUser32 instance=(MyUser32) Native.loadLibrary("user32", MyUser32.class, W32APIOptions.DEFAULT_OPTIONS); public boolean SetWindowPos(HWND hwnd, int hwnd2, int arg1, int arg2, int arg3, int arg4, int flags); public int EnableWindow(HWND hwnd, boolean enabled); } public static void main(String[] params){ HWND tst= MyUser32.instance.FindWindow(null, "Калькулятор"); MyUser32.instance.SetWindowPos(tst, -1, 200, 200, 100, 100, 0x0040|0x0002|0x0001); MyUser32.instance.EnableWindow(tst, true); } }
If you need a modal window from which you cannot go back (well, for example, as a file selection or a dialog box), then you need to set all parents of this window to enabled to false (there is no such option for the window "modality", but if it has all parents not active, you cannot switch out of it).
To change the activity is the function EnableWindow.