Package com.formdev.flatlaf.ui
Class FlatWindowsNativeWindowBorder
- java.lang.Object
-
- com.formdev.flatlaf.ui.FlatWindowsNativeWindowBorder
-
- All Implemented Interfaces:
FlatNativeWindowBorder.Provider
class FlatWindowsNativeWindowBorder extends java.lang.Object implements FlatNativeWindowBorder.Provider
Native window border support for Windows 10 when using custom decorations.If the application wants to use custom decorations, the Windows 10 title bar is hidden (including minimize, maximize and close buttons), but not the resize borders (including drop shadow). Windows 10 window snapping functionality will remain unaffected: https://support.microsoft.com/en-us/windows/snap-your-windows-885a9b1e-a983-a3b1-16cd-c531795e6241
- Since:
- 1.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classFlatWindowsNativeWindowBorder.WndProc
-
Field Summary
Fields Modifier and Type Field Description private java.awt.ColorcolorizationColorprivate booleancolorizationColorAffectsBordersprivate intcolorizationColorBalanceprivate booleancolorizationUpToDateprivate javax.swing.TimerfireStateChangedTimerprivate static FlatWindowsNativeWindowBorderinstanceprivate javax.swing.event.EventListenerListlistenerListprivate java.util.Map<java.awt.Window,FlatWindowsNativeWindowBorder.WndProc>windowsMap-
Fields inherited from interface com.formdev.flatlaf.ui.FlatNativeWindowBorder.Provider
SW_MAXIMIZE, SW_MINIMIZE, SW_RESTORE
-
-
Constructor Summary
Constructors Modifier Constructor Description privateFlatWindowsNativeWindowBorder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(javax.swing.event.ChangeListener l)private static java.awt.RectanglecloneRectange(java.awt.Rectangle rect)private voidfireStateChanged()(package private) voidfireStateChangedLaterOnce()Because there may be sent many WM_DWMCOLORIZATIONCOLORCHANGED messages, slightly delay event firing and fire it only once (on the AWT thread).java.awt.ColorgetColorizationColor()intgetColorizationColorBalance()(package private) static FlatNativeWindowBorder.ProvidergetInstance()booleanhasCustomDecoration(java.awt.Window window)private voidinstall(java.awt.Window window)booleanisColorizationColorAffectsBorders()private static intregistryGetIntValue(java.lang.String key, java.lang.String valueName, int defaultValue)voidremoveChangeListener(javax.swing.event.ChangeListener l)voidsetHasCustomDecoration(java.awt.Window window, boolean hasCustomDecoration)Tell the window whether the application wants to use custom decorations.booleanshowWindow(java.awt.Window window, int cmd)private voiduninstall(java.awt.Window window)private voidupdateColorization()voidupdateTitleBarInfo(java.awt.Window window, int titleBarHeight, java.util.function.Predicate<java.awt.Point> captionHitTestCallback, java.awt.Rectangle appIconBounds, java.awt.Rectangle minimizeButtonBounds, java.awt.Rectangle maximizeButtonBounds, java.awt.Rectangle closeButtonBounds)
-
-
-
Field Detail
-
windowsMap
private final java.util.Map<java.awt.Window,FlatWindowsNativeWindowBorder.WndProc> windowsMap
-
listenerList
private final javax.swing.event.EventListenerList listenerList
-
fireStateChangedTimer
private javax.swing.Timer fireStateChangedTimer
-
colorizationUpToDate
private boolean colorizationUpToDate
-
colorizationColorAffectsBorders
private boolean colorizationColorAffectsBorders
-
colorizationColor
private java.awt.Color colorizationColor
-
colorizationColorBalance
private int colorizationColorBalance
-
instance
private static FlatWindowsNativeWindowBorder instance
-
-
Method Detail
-
getInstance
static FlatNativeWindowBorder.Provider getInstance()
-
hasCustomDecoration
public boolean hasCustomDecoration(java.awt.Window window)
- Specified by:
hasCustomDecorationin interfaceFlatNativeWindowBorder.Provider
-
setHasCustomDecoration
public void setHasCustomDecoration(java.awt.Window window, boolean hasCustomDecoration)Tell the window whether the application wants to use custom decorations. Iftrue, the Windows 10 title bar is hidden (including minimize, maximize and close buttons), but not the resize borders (including drop shadow).- Specified by:
setHasCustomDecorationin interfaceFlatNativeWindowBorder.Provider
-
install
private void install(java.awt.Window window)
-
uninstall
private void uninstall(java.awt.Window window)
-
updateTitleBarInfo
public void updateTitleBarInfo(java.awt.Window window, int titleBarHeight, java.util.function.Predicate<java.awt.Point> captionHitTestCallback, java.awt.Rectangle appIconBounds, java.awt.Rectangle minimizeButtonBounds, java.awt.Rectangle maximizeButtonBounds, java.awt.Rectangle closeButtonBounds)- Specified by:
updateTitleBarInfoin interfaceFlatNativeWindowBorder.Provider
-
cloneRectange
private static java.awt.Rectangle cloneRectange(java.awt.Rectangle rect)
-
showWindow
public boolean showWindow(java.awt.Window window, int cmd)- Specified by:
showWindowin interfaceFlatNativeWindowBorder.Provider
-
isColorizationColorAffectsBorders
public boolean isColorizationColorAffectsBorders()
- Specified by:
isColorizationColorAffectsBordersin interfaceFlatNativeWindowBorder.Provider
-
getColorizationColor
public java.awt.Color getColorizationColor()
- Specified by:
getColorizationColorin interfaceFlatNativeWindowBorder.Provider
-
getColorizationColorBalance
public int getColorizationColorBalance()
- Specified by:
getColorizationColorBalancein interfaceFlatNativeWindowBorder.Provider
-
updateColorization
private void updateColorization()
-
registryGetIntValue
private static int registryGetIntValue(java.lang.String key, java.lang.String valueName, int defaultValue)
-
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener l)
- Specified by:
addChangeListenerin interfaceFlatNativeWindowBorder.Provider
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
- Specified by:
removeChangeListenerin interfaceFlatNativeWindowBorder.Provider
-
fireStateChanged
private void fireStateChanged()
-
fireStateChangedLaterOnce
void fireStateChangedLaterOnce()
Because there may be sent many WM_DWMCOLORIZATIONCOLORCHANGED messages, slightly delay event firing and fire it only once (on the AWT thread).
-
-