Class FlatNativeWindowsLibrary
- java.lang.Object
-
- com.formdev.flatlaf.ui.FlatNativeWindowsLibrary
-
public class FlatNativeWindowsLibrary extends Object
Native methods for Windows.Note: This is private API. Do not use!
- Since:
- 3.1
-
-
Field Summary
Fields Modifier and Type Field Description static ColorCOLOR_NONEstatic intDWMWA_BORDER_COLORDWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattributestatic intDWMWA_CAPTION_COLORDWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattributestatic intDWMWA_COLOR_DEFAULTstatic intDWMWA_COLOR_NONEstatic intDWMWA_TEXT_COLORDWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattributestatic intDWMWA_USE_IMMERSIVE_DARK_MODEDWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattributestatic intDWMWCP_DEFAULTDWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preferencestatic intDWMWCP_DONOTROUNDDWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preferencestatic intDWMWCP_ROUNDDWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preferencestatic intDWMWCP_ROUNDSMALLDWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preference
-
Constructor Summary
Constructors Constructor Description FlatNativeWindowsLibrary()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleandwmSetWindowAttributeBOOL(long hwnd, int attribute, boolean value)Invokes Win32 API methodDwmSetWindowAttribute()with aBOOLattribute value.static booleandwmSetWindowAttributeCOLORREF(long hwnd, int attribute, Color color)Invokes Win32 API methodDwmSetWindowAttribute()with aCOLORREFattribute value.static booleandwmSetWindowAttributeDWORD(long hwnd, int attribute, int value)Invokes Win32 API methodDwmSetWindowAttribute()with aDWORDattribute value.static longgetHWND(Window window)Gets the Windows window handle (HWND) for the given Swing window.static longgetOSBuildNumber()Gets the Windows operating system build number.static booleanisLoaded()Checks whether native library is loaded/available.static booleansetWindowCornerPreference(long hwnd, int cornerPreference)Sets the rounded corner preference for the window.
-
-
-
Field Detail
-
DWMWCP_DEFAULT
public static final int DWMWCP_DEFAULT
DWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preference- See Also:
- Constant Field Values
-
DWMWCP_DONOTROUND
public static final int DWMWCP_DONOTROUND
DWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preference- See Also:
- Constant Field Values
-
DWMWCP_ROUND
public static final int DWMWCP_ROUND
DWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preference- See Also:
- Constant Field Values
-
DWMWCP_ROUNDSMALL
public static final int DWMWCP_ROUNDSMALL
DWM_WINDOW_CORNER_PREFERENCE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preference- See Also:
- Constant Field Values
-
DWMWA_USE_IMMERSIVE_DARK_MODE
public static final int DWMWA_USE_IMMERSIVE_DARK_MODE
DWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute- Since:
- 3.3
- See Also:
- Constant Field Values
-
DWMWA_BORDER_COLOR
public static final int DWMWA_BORDER_COLOR
DWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute- Since:
- 3.3
- See Also:
- Constant Field Values
-
DWMWA_CAPTION_COLOR
public static final int DWMWA_CAPTION_COLOR
DWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute- Since:
- 3.3
- See Also:
- Constant Field Values
-
DWMWA_TEXT_COLOR
public static final int DWMWA_TEXT_COLOR
DWMWINDOWATTRIBUTE see https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute- Since:
- 3.3
- See Also:
- Constant Field Values
-
DWMWA_COLOR_DEFAULT
public static final int DWMWA_COLOR_DEFAULT
- Since:
- 3.3
- See Also:
- Constant Field Values
-
DWMWA_COLOR_NONE
public static final int DWMWA_COLOR_NONE
- Since:
- 3.3
- See Also:
- Constant Field Values
-
COLOR_NONE
public static final Color COLOR_NONE
- Since:
- 3.3
-
-
Method Detail
-
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
-
getHWND
public static long getHWND(Window window)
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_ROUNDandDWMWCP_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 aBOOLattribute 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 aDWORDattribute value. See https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute- Since:
- 3.3
-
dwmSetWindowAttributeCOLORREF
public static boolean dwmSetWindowAttributeCOLORREF(long hwnd, int attribute, Color color)Invokes Win32 API methodDwmSetWindowAttribute()with aCOLORREFattribute value. See https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattributeSupported since Windows 11 Build 22000.
- Since:
- 3.3
-
-