Class FlatNativeWindowsLibrary
Note: This is private API. Do not use!
- Since:
- 3.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static int
static final Color
static final int
DWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattributestatic final int
DWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattributestatic final int
static final int
static final int
DWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattributestatic final int
DWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattributestatic final int
DWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preferencestatic final int
DWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preferencestatic final int
DWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preferencestatic final int
DWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preferenceprivate static long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
dwmSetWindowAttributeBOOL
(long hwnd, int attribute, boolean value) Invokes Win32 API methodDwmSetWindowAttribute()
with aBOOL
attribute value.static boolean
dwmSetWindowAttributeCOLORREF
(long hwnd, int attribute, Color color) Invokes Win32 API methodDwmSetWindowAttribute()
with aCOLORREF
attribute value.static boolean
dwmSetWindowAttributeDWORD
(long hwnd, int attribute, int value) Invokes Win32 API methodDwmSetWindowAttribute()
with aDWORD
attribute value.static long
Gets the Windows window handle (HWND) for the given Swing window.static long
Gets the Windows operating system build number.private static long
Invokes Win32 API methodGetVersionEx()
and returnsOSVERSIONINFO.dwBuildNumber
.static boolean
isLoaded()
Checks whether native library is loaded/available.static boolean
setWindowCornerPreference
(long hwnd, int cornerPreference) Sets the rounded corner preference for the window.
-
Field Details
-
API_VERSION_WINDOWS
private static int API_VERSION_WINDOWS -
osBuildNumber
private static long osBuildNumber -
DWMWCP_DEFAULT
public static final int DWMWCP_DEFAULTDWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preference- See Also:
-
DWMWCP_DONOTROUND
public static final int DWMWCP_DONOTROUNDDWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preference- See Also:
-
DWMWCP_ROUND
public static final int DWMWCP_ROUNDDWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preference- See Also:
-
DWMWCP_ROUNDSMALL
public static final int DWMWCP_ROUNDSMALLDWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preference- See Also:
-
DWMWA_USE_IMMERSIVE_DARK_MODE
public static final int DWMWA_USE_IMMERSIVE_DARK_MODEDWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute- Since:
- 3.3
- See Also:
-
DWMWA_BORDER_COLOR
public static final int DWMWA_BORDER_COLORDWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute- Since:
- 3.3
- See Also:
-
DWMWA_CAPTION_COLOR
public static final int DWMWA_CAPTION_COLORDWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute- Since:
- 3.3
- See Also:
-
DWMWA_TEXT_COLOR
public static final int DWMWA_TEXT_COLORDWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute- Since:
- 3.3
- See Also:
-
DWMWA_COLOR_DEFAULT
public static final int DWMWA_COLOR_DEFAULT- Since:
- 3.3
- See Also:
-
DWMWA_COLOR_NONE
public static final int DWMWA_COLOR_NONE- Since:
- 3.3
- See Also:
-
COLOR_NONE
- Since:
- 3.3
-
-
Constructor Details
-
FlatNativeWindowsLibrary
public FlatNativeWindowsLibrary()
-
-
Method Details
-
isLoaded
public static boolean isLoaded()Checks whether native library is loaded/available.Note: It is required to invoke this method before invoking any other method of this class. Otherwise, the native library may not be loaded.
-
getOSBuildNumber
public static long getOSBuildNumber()Gets the Windows operating system build number.Invokes Win32 API method
GetVersionEx()
and returnsOSVERSIONINFO.dwBuildNumber
. See https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getversionexa -
getOSBuildNumberImpl
private static long getOSBuildNumberImpl()Invokes Win32 API methodGetVersionEx()
and returnsOSVERSIONINFO.dwBuildNumber
. See https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getversionexa -
getHWND
Gets the Windows window handle (HWND) for the given Swing window.Note that the underlying Windows window must be already created, otherwise this method returns zero. Use following to ensure this:
or invoke this method after packing the window. E.g.if( !window.isDisplayable() ) window.addNotify();
window.pack(); long hwnd = getHWND( window );
-
setWindowCornerPreference
public static boolean setWindowCornerPreference(long hwnd, int cornerPreference) Sets the rounded corner preference for the window. Allowed values areDWMWCP_DEFAULT
,DWMWCP_DONOTROUND
,DWMWCP_ROUND
andDWMWCP_ROUNDSMALL
.Invokes Win32 API method
DwmSetWindowAttribute(DWMWA_WINDOW_CORNER_PREFERENCE)
. See https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattributeSupported since Windows 11 Build 22000.
-
dwmSetWindowAttributeBOOL
public static boolean dwmSetWindowAttributeBOOL(long hwnd, int attribute, boolean value) Invokes Win32 API methodDwmSetWindowAttribute()
with aBOOL
attribute value. See https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute- Since:
- 3.3
-
dwmSetWindowAttributeDWORD
public static boolean dwmSetWindowAttributeDWORD(long hwnd, int attribute, int value) Invokes Win32 API methodDwmSetWindowAttribute()
with aDWORD
attribute value. See https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute- Since:
- 3.3
-
dwmSetWindowAttributeCOLORREF
Invokes Win32 API methodDwmSetWindowAttribute()
with aCOLORREF
attribute value. See https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattributeSupported since Windows 11 Build 22000.
- Since:
- 3.3
-