ToolBar: foolbars are no longer floatable by default

This commit is contained in:
Karl Tauber
2021-10-04 15:31:55 +02:00
parent bb2a21270b
commit e34fbcec58
7 changed files with 30 additions and 1 deletions

View File

@@ -51,6 +51,7 @@ import com.formdev.flatlaf.util.LoggingFacade;
* <!-- FlatToolBarUI -->
*
* @uiDefault ToolBar.focusableButtons boolean
* @uiDefault ToolBar.floatable boolean
*
* <!-- FlatToolBarBorder -->
*
@@ -70,6 +71,7 @@ public class FlatToolBarUI
@Styleable protected Insets borderMargins;
@Styleable protected Color gripColor;
private Boolean oldFloatable;
private Map<String, Object> oldStyleValues;
public static ComponentUI createUI( JComponent c ) {
@@ -103,6 +105,23 @@ public class FlatToolBarUI
super.installDefaults();
focusableButtons = UIManager.getBoolean( "ToolBar.focusableButtons" );
// floatable
if( !UIManager.getBoolean( "ToolBar.floatable" ) ) {
oldFloatable = toolBar.isFloatable();
toolBar.setFloatable( false );
} else
oldFloatable = null;
}
@Override
protected void uninstallDefaults() {
super.uninstallDefaults();
if( oldFloatable != null ) {
toolBar.setFloatable( oldFloatable );
oldFloatable = null;
}
}
@Override

View File

@@ -760,6 +760,8 @@ ToggleButton.tab.focusBackground = $TabbedPane.focusColor
ToolBar.border = com.formdev.flatlaf.ui.FlatToolBarBorder
ToolBar.borderMargins = 2,2,2,2
ToolBar.isRollover = true
ToolBar.floatable = false
ToolBar.focusableButtons = false
ToolBar.gripColor = @icon
ToolBar.dockingBackground = darken($ToolBar.background,5%)
ToolBar.dockingForeground = $Component.borderColor
@@ -770,8 +772,9 @@ ToolBar.separatorSize = null
ToolBar.separatorWidth = 7
ToolBar.separatorColor = $Separator.foreground
# not used in FlatLaf; intended for custom components in toolbar
# https://github.com/JFormDesigner/FlatLaf/issues/56#issuecomment-586297814
ToolBar.spacingBorder = $Button.toolbar.spacingInsets
ToolBar.focusableButtons = false
#---- ToolTipManager ----