mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 23:08:42 +03:00
ToolBar: added empty space around toolbar (issue #56)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user