Window decorations: made most fields protected for extending/subclassing

This commit is contained in:
Karl Tauber
2020-07-01 10:49:18 +02:00
parent a308114b2f
commit 65b54ced7a
3 changed files with 30 additions and 28 deletions

View File

@@ -69,10 +69,11 @@ public class FlatRootPaneUI
static final boolean canUseJBRCustomDecorations static final boolean canUseJBRCustomDecorations
= SystemInfo.IS_JETBRAINS_JVM_11_OR_LATER && SystemInfo.IS_WINDOWS_10_OR_LATER; = SystemInfo.IS_JETBRAINS_JVM_11_OR_LATER && SystemInfo.IS_WINDOWS_10_OR_LATER;
private JRootPane rootPane; protected JRootPane rootPane;
private FlatTitlePane titlePane; protected FlatTitlePane titlePane;
protected FlatWindowResizer windowResizer;
private LayoutManager oldLayout; private LayoutManager oldLayout;
private FlatWindowResizer windowResizer;
public static ComponentUI createUI( JComponent c ) { public static ComponentUI createUI( JComponent c ) {
return new FlatRootPaneUI(); return new FlatRootPaneUI();

View File

@@ -90,30 +90,31 @@ import com.formdev.flatlaf.util.UIScale;
public class FlatTitlePane public class FlatTitlePane
extends JComponent extends JComponent
{ {
private final Color activeBackground = UIManager.getColor( "TitlePane.background" ); protected final Color activeBackground = UIManager.getColor( "TitlePane.background" );
private final Color inactiveBackground = UIManager.getColor( "TitlePane.inactiveBackground" ); protected final Color inactiveBackground = UIManager.getColor( "TitlePane.inactiveBackground" );
private final Color activeForeground = UIManager.getColor( "TitlePane.foreground" ); protected final Color activeForeground = UIManager.getColor( "TitlePane.foreground" );
private final Color inactiveForeground = UIManager.getColor( "TitlePane.inactiveForeground" ); protected final Color inactiveForeground = UIManager.getColor( "TitlePane.inactiveForeground" );
private final Color embeddedForeground = UIManager.getColor( "TitlePane.embeddedForeground" ); protected final Color embeddedForeground = UIManager.getColor( "TitlePane.embeddedForeground" );
private final Insets menuBarMargins = UIManager.getInsets( "TitlePane.menuBarMargins" ); protected final Insets menuBarMargins = UIManager.getInsets( "TitlePane.menuBarMargins" );
private final Dimension iconSize = UIManager.getDimension( "TitlePane.iconSize" ); protected final Dimension iconSize = UIManager.getDimension( "TitlePane.iconSize" );
private final int buttonMaximizedHeight = UIManager.getInt( "TitlePane.buttonMaximizedHeight" ); protected final int buttonMaximizedHeight = UIManager.getInt( "TitlePane.buttonMaximizedHeight" );
private final JRootPane rootPane; protected final JRootPane rootPane;
private JPanel leftPanel; protected JPanel leftPanel;
private JLabel iconLabel; protected JLabel iconLabel;
private JComponent menuBarPlaceholder; protected JComponent menuBarPlaceholder;
private JLabel titleLabel; protected JLabel titleLabel;
private JPanel buttonPanel; protected JPanel buttonPanel;
private JButton iconifyButton; protected JButton iconifyButton;
private JButton maximizeButton; protected JButton maximizeButton;
private JButton restoreButton; protected JButton restoreButton;
private JButton closeButton; protected JButton closeButton;
protected Window window;
private final Handler handler; private final Handler handler;
private Window window;
public FlatTitlePane( JRootPane rootPane ) { public FlatTitlePane( JRootPane rootPane ) {
this.rootPane = rootPane; this.rootPane = rootPane;

View File

@@ -51,15 +51,15 @@ public class FlatWindowResizer
extends JComponent extends JComponent
implements PropertyChangeListener, WindowStateListener, ComponentListener implements PropertyChangeListener, WindowStateListener, ComponentListener
{ {
private final static Integer WINDOW_RESIZER_LAYER = JLayeredPane.DRAG_LAYER + 1; protected final static Integer WINDOW_RESIZER_LAYER = JLayeredPane.DRAG_LAYER + 1;
private final JRootPane rootPane; protected final JRootPane rootPane;
private final int borderDragThickness = FlatUIUtils.getUIInt( "RootPane.borderDragThickness", 5 ); protected final int borderDragThickness = FlatUIUtils.getUIInt( "RootPane.borderDragThickness", 5 );
private final int cornerDragWidth = FlatUIUtils.getUIInt( "RootPane.cornerDragWidth", 16 ); protected final int cornerDragWidth = FlatUIUtils.getUIInt( "RootPane.cornerDragWidth", 16 );
private final boolean honorMinimumSizeOnResize = UIManager.getBoolean( "RootPane.honorMinimumSizeOnResize" ); protected final boolean honorMinimumSizeOnResize = UIManager.getBoolean( "RootPane.honorMinimumSizeOnResize" );
private Window window; protected Window window;
public FlatWindowResizer( JRootPane rootPane ) { public FlatWindowResizer( JRootPane rootPane ) {
this.rootPane = rootPane; this.rootPane = rootPane;