Class 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
    • Field Detail

      • 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
    • Constructor Detail

      • FlatWindowsNativeWindowBorder

        private FlatWindowsNativeWindowBorder()
    • Method Detail

      • setHasCustomDecoration

        public void setHasCustomDecoration​(java.awt.Window window,
                                           boolean hasCustomDecoration)
        Tell the window whether the application wants to use custom decorations. If true, 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 interface FlatNativeWindowBorder.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 interface FlatNativeWindowBorder.Provider
      • cloneRectange

        private static java.awt.Rectangle cloneRectange​(java.awt.Rectangle rect)
      • updateColorization

        private void updateColorization()
      • registryGetIntValue

        private static int registryGetIntValue​(java.lang.String key,
                                               java.lang.String valueName,
                                               int defaultValue)
      • 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).