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