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 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 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()static booleansetWindowBorderColor(long hwnd, int red, int green, int blue)Sets the color of the window border.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
-
-
Method Detail
-
isLoaded
public static boolean isLoaded()
-
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.
-
setWindowBorderColor
public static boolean setWindowBorderColor(long hwnd, int red, int green, int blue)Sets the color of the window border. The red/green/blue values must be in range0 - 255. If red is-1, then the system default border color is used (useful to reset the border color). If red is-2, then no border is painted.Invokes Win32 API method
DwmSetWindowAttribute(DWMWA_BORDER_COLOR). See https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattributeSupported since Windows 11 Build 22000.
-
-