Issue
I have to put my application transparent window over the top of every application//not just within application < Im aware that i can set modality on stage and put it on top bud thats not what i look for >// (same functionality as swing's setAlwaysOnTop(true)),bud since this is JavaFX application i dont have this option yet.So i decided to go native, i have JNA class
public interface Kernel32 extends StdCallLibrary {
public static class WinOnTop extends Structure {
public HWND hWnd;
public HWND hWndInsertAfter;
public int X;
public int Y;
public int cx;
public int cy;
public int uFlags;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"hWnd", "hWndInsertAfter", "X", "Y", "cx", "cy", "uFlags"});
}
}
boolean SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx,
int cy, int uFlags);
}
And resource i use to create it is
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545%28v=vs.85%29.aspx
In my main i create object as:
public static Kernel32 kernel;
static{
kernel=(Kernel32)Native.loadLibrary("Kernel32", Kernel32.class);
}
This is my first time that i try to add some native functionality into my application.
My question is how do i preceed? How can i say that THIS IS THE STAGE THAT I WANT TO APPLY THIS FUNCTIONALITY TO , i really need to point to the right direction as i dont know what im doing atm with JNA
I have seen some tutotial on how to acess time bud its only working with simple variable,How can i connect thos function with my Transparent Stage?
Solution
Don't use JNA, use Java8u20 or any other subsequent version, which has a JavaFX always on top feature.
stage.setAlwaysOnTop(true);
There is a nice blog post by Carl Dea on always on top.
Answered By - jewelsea
Answer Checked By - Cary Denson (JavaFixing Admin)