mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 06:50:56 +03:00
ToolBar: added empty space around toolbar (issue #56)
This commit is contained in:
@@ -17,8 +17,9 @@ FlatLaf Change Log
|
||||
is "..." or a single character.
|
||||
- ToolBar: No longer use special rollover border for buttons in toolbar. (issue
|
||||
#36)
|
||||
- ToolBar: Added empty space around buttons in toolbar (see UI default value
|
||||
`Button.toolbar.spacingInsets`). (issue #56)
|
||||
- ToolBar: Added empty space around buttons in toolbar and toolbar itself (see
|
||||
UI default values `Button.toolbar.spacingInsets` and `ToolBar.borderMargins`).
|
||||
(issue #56)
|
||||
- Fixed "illegal reflective access operation" warning on macOS when using Java
|
||||
12 or later. (issue #60, PR #61)
|
||||
|
||||
|
||||
@@ -29,13 +29,26 @@ import javax.swing.plaf.basic.BasicBorders;
|
||||
public class FlatMarginBorder
|
||||
extends BasicBorders.MarginBorder
|
||||
{
|
||||
private final int left, right, top, bottom;
|
||||
|
||||
public FlatMarginBorder() {
|
||||
left = right = top = bottom = 0;
|
||||
}
|
||||
|
||||
public FlatMarginBorder( Insets insets ) {
|
||||
left = insets.left;
|
||||
top = insets.top;
|
||||
right = insets.right;
|
||||
bottom = insets.bottom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets( Component c, Insets insets ) {
|
||||
insets = super.getBorderInsets( c, insets );
|
||||
insets.top = scale( insets.top );
|
||||
insets.left = scale( insets.left );
|
||||
insets.bottom = scale( insets.bottom );
|
||||
insets.right = scale( insets.right );
|
||||
insets.top = scale( insets.top + top );
|
||||
insets.left = scale( insets.left + left );
|
||||
insets.bottom = scale( insets.bottom + bottom );
|
||||
insets.right = scale( insets.right + right );
|
||||
return insets;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import javax.swing.UIManager;
|
||||
/**
|
||||
* Border for {@link javax.swing.JToolBar}.
|
||||
*
|
||||
* @uiDefault ToolBar.borderMargins Insets
|
||||
* @uiDefault ToolBar.gripColor Color
|
||||
*
|
||||
* @author Karl Tauber
|
||||
@@ -42,6 +43,10 @@ public class FlatToolBarBorder
|
||||
|
||||
protected final Color gripColor = UIManager.getColor( "ToolBar.gripColor" );
|
||||
|
||||
public FlatToolBarBorder() {
|
||||
super( UIManager.getInsets( "ToolBar.borderMargins" ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
|
||||
// paint grip
|
||||
|
||||
@@ -505,6 +505,7 @@ ToggleButton.tab.focusBackground=$TabbedPane.focusColor
|
||||
#---- ToolBar ----
|
||||
|
||||
ToolBar.border=com.formdev.flatlaf.ui.FlatToolBarBorder
|
||||
ToolBar.borderMargins=2,2,2,2
|
||||
ToolBar.isRollover=true
|
||||
ToolBar.gripColor=@icon
|
||||
ToolBar.dockingBackground=@background
|
||||
|
||||
@@ -1890,8 +1890,9 @@ ToolBar.ancestorInputMap [lazy] 8 javax.swing.plaf.InputMapUIResource [
|
||||
pressed RIGHT navigateRight
|
||||
pressed UP navigateUp
|
||||
ToolBar.background #3c3f41 javax.swing.plaf.ColorUIResource [UI]
|
||||
ToolBar.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatToolBarBorder [UI]
|
||||
ToolBar.border [lazy] 2,2,2,2 false com.formdev.flatlaf.ui.FlatToolBarBorder [UI]
|
||||
ToolBar.borderColor #cccccc javax.swing.plaf.ColorUIResource [UI]
|
||||
ToolBar.borderMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
|
||||
ToolBar.darkShadow #7a8a99 javax.swing.plaf.ColorUIResource [UI]
|
||||
ToolBar.dockingBackground #3c3f41 javax.swing.plaf.ColorUIResource [UI]
|
||||
ToolBar.dockingForeground #6382bf javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
@@ -1892,8 +1892,9 @@ ToolBar.ancestorInputMap [lazy] 8 javax.swing.plaf.InputMapUIResource [
|
||||
pressed RIGHT navigateRight
|
||||
pressed UP navigateUp
|
||||
ToolBar.background #f2f2f2 javax.swing.plaf.ColorUIResource [UI]
|
||||
ToolBar.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatToolBarBorder [UI]
|
||||
ToolBar.border [lazy] 2,2,2,2 false com.formdev.flatlaf.ui.FlatToolBarBorder [UI]
|
||||
ToolBar.borderColor #cccccc javax.swing.plaf.ColorUIResource [UI]
|
||||
ToolBar.borderMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
|
||||
ToolBar.darkShadow #7a8a99 javax.swing.plaf.ColorUIResource [UI]
|
||||
ToolBar.dockingBackground #f2f2f2 javax.swing.plaf.ColorUIResource [UI]
|
||||
ToolBar.dockingForeground #6382bf javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
Reference in New Issue
Block a user