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 class
FlatWindowsNativeWindowBorder.WndProc
-
Field Summary
Fields Modifier and Type Field Description private java.awt.Color
colorizationColor
private boolean
colorizationColorAffectsBorders
private int
colorizationColorBalance
private boolean
colorizationUpToDate
private javax.swing.Timer
fireStateChangedTimer
private static FlatWindowsNativeWindowBorder
instance
private javax.swing.event.EventListenerList
listenerList
private 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 private
FlatWindowsNativeWindowBorder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChangeListener(javax.swing.event.ChangeListener l)
private static java.awt.Rectangle
cloneRectange(java.awt.Rectangle rect)
private void
fireStateChanged()
(package private) void
fireStateChangedLaterOnce()
Because there may be sent many WM_DWMCOLORIZATIONCOLORCHANGED messages, slightly delay event firing and fire it only once (on the AWT thread).java.awt.Color
getColorizationColor()
int
getColorizationColorBalance()
(package private) static FlatNativeWindowBorder.Provider
getInstance()
boolean
hasCustomDecoration(java.awt.Window window)
private void
install(java.awt.Window window)
boolean
isColorizationColorAffectsBorders()
private static int
registryGetIntValue(java.lang.String key, java.lang.String valueName, int defaultValue)
void
removeChangeListener(javax.swing.event.ChangeListener l)
void
setHasCustomDecoration(java.awt.Window window, boolean hasCustomDecoration)
Tell the window whether the application wants to use custom decorations.boolean
showWindow(java.awt.Window window, int cmd)
private void
uninstall(java.awt.Window window)
private void
updateColorization()
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)
-
-
-
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:
hasCustomDecoration
in 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:
setHasCustomDecoration
in 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:
updateTitleBarInfo
in 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:
showWindow
in interfaceFlatNativeWindowBorder.Provider
-
isColorizationColorAffectsBorders
public boolean isColorizationColorAffectsBorders()
- Specified by:
isColorizationColorAffectsBorders
in interfaceFlatNativeWindowBorder.Provider
-
getColorizationColor
public java.awt.Color getColorizationColor()
- Specified by:
getColorizationColor
in interfaceFlatNativeWindowBorder.Provider
-
getColorizationColorBalance
public int getColorizationColorBalance()
- Specified by:
getColorizationColorBalance
in 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:
addChangeListener
in interfaceFlatNativeWindowBorder.Provider
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
- Specified by:
removeChangeListener
in 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).
-
-