Browse Source

Replaced hard coded inset values with properties.

Signed-off-by: weisj <weisj@arcor.de>
pull/37/head^2
weisj 5 years ago
parent
commit
371cf77df6
  1. 7
      core/src/main/java/com/github/weisj/darklaf/components/border/BubbleBorder.java
  2. 13
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java
  3. 12
      core/src/main/java/com/github/weisj/darklaf/ui/checkbox/DarkCheckBoxBorder.java
  4. 26
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java
  5. 12
      core/src/main/java/com/github/weisj/darklaf/ui/radiobutton/DarkRadioButtonBorder.java
  6. 8
      core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerBorder.java
  7. 9
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/MoreTabsButton.java
  8. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/NewTabButton.java
  9. 5
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkPanelPopupUI.java
  10. 13
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextBorder.java
  11. 4
      core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeCellBorder.java
  12. 19
      core/src/main/java/com/github/weisj/darklaf/util/PropertyLoader.java
  13. 2
      core/src/main/resources/com/github/weisj/darklaf/properties/platform/mac.properties
  14. 4
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties
  15. 3
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/checkBox.properties
  16. 5
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/comboBox.properties
  17. 4
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/radioButton.properties
  18. 5
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/spinner.properties
  19. 2
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/tabFrame.properties
  20. 5
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/tabbedPane.properties
  21. 3
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/text.properties
  22. 4
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/tree.properties

7
core/src/main/java/com/github/weisj/darklaf/components/border/BubbleBorder.java

@ -28,6 +28,7 @@ import com.github.weisj.darklaf.util.GraphicsContext;
import com.github.weisj.darklaf.util.GraphicsUtil; import com.github.weisj.darklaf.util.GraphicsUtil;
import javax.swing.border.AbstractBorder; import javax.swing.border.AbstractBorder;
import javax.swing.plaf.InsetsUIResource;
import java.awt.*; import java.awt.*;
import java.awt.geom.Area; import java.awt.geom.Area;
import java.awt.geom.Path2D; import java.awt.geom.Path2D;
@ -74,7 +75,7 @@ public class BubbleBorder extends AbstractBorder {
this.radius = radius; this.radius = radius;
this.pointerSize = pointerSize; this.pointerSize = pointerSize;
this.pointerWidth = pointerSize; this.pointerWidth = pointerSize;
insets = new Insets(0, 0, 0, 0); insets = new InsetsUIResource(0, 0, 0, 0);
setThickness(thickness); setThickness(thickness);
} }
@ -275,7 +276,7 @@ public class BubbleBorder extends AbstractBorder {
@Override @Override
public Insets getBorderInsets(final Component c) { public Insets getBorderInsets(final Component c) {
return new Insets(insets.top, insets.left, insets.bottom, insets.right); return new InsetsUIResource(insets.top, insets.left, insets.bottom, insets.right);
} }
@ -348,4 +349,4 @@ public class BubbleBorder extends AbstractBorder {
pointer.closePath(); pointer.closePath();
return pointer; return pointer;
} }
} }

13
core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java

@ -57,6 +57,8 @@ public class DarkButtonBorder implements Border, UIResource {
private Insets thinInsets; private Insets thinInsets;
private Insets squareInsets; private Insets squareInsets;
private Insets squareThinInsets; private Insets squareThinInsets;
private Insets labelInsets;
private Insets shadowInsets;
public DarkButtonBorder() { public DarkButtonBorder() {
shadowColor = UIManager.getColor("Button.shadow"); shadowColor = UIManager.getColor("Button.shadow");
@ -75,6 +77,8 @@ public class DarkButtonBorder implements Border, UIResource {
thinInsets = UIManager.getInsets("Button.thinBorderInsets"); thinInsets = UIManager.getInsets("Button.thinBorderInsets");
squareInsets = UIManager.getInsets("Button.squareBorderInsets"); squareInsets = UIManager.getInsets("Button.squareBorderInsets");
squareThinInsets = UIManager.getInsets("Button.squareThinBorderInsets"); squareThinInsets = UIManager.getInsets("Button.squareThinBorderInsets");
labelInsets = UIManager.getInsets("Button.onlyLabelInsets");
shadowInsets = UIManager.getInsets("Button.fullShadowInsets");
} }
@Override @Override
@ -161,13 +165,16 @@ public class DarkButtonBorder implements Border, UIResource {
} }
public Insets getBorderInsets(final Component c) { public Insets getBorderInsets(final Component c) {
if (DarkButtonUI.isFullShadow(c) || DarkButtonUI.isLabelButton(c)) { if (DarkButtonUI.isFullShadow(c)) {
return new InsetsUIResource(0, 0, 0, 0); return new InsetsUIResource(shadowInsets.top, shadowInsets.left, shadowInsets.bottom, shadowInsets.right);
}
if (DarkButtonUI.isLabelButton(c)) {
return new InsetsUIResource(labelInsets.top, labelInsets.left, labelInsets.bottom, labelInsets.right);
} }
int shadow = DarkButtonUI.isShadowVariant(c) ? 0 : getShadowSize(); int shadow = DarkButtonUI.isShadowVariant(c) ? 0 : getShadowSize();
boolean square = DarkButtonUI.isSquare(c); boolean square = DarkButtonUI.isSquare(c);
Insets pad = isThin(c) ? square ? squareThinInsets : thinInsets Insets pad = isThin(c) ? square ? squareThinInsets : thinInsets
: square ? squareInsets : insets; : square ? squareInsets : insets;
return new InsetsUIResource(pad.top, pad.left, pad.bottom + shadow, pad.right); return new InsetsUIResource(pad.top, pad.left, pad.bottom + shadow, pad.right);
} }

12
core/src/main/java/com/github/weisj/darklaf/ui/checkbox/DarkCheckBoxBorder.java

@ -25,7 +25,6 @@ package com.github.weisj.darklaf.ui.checkbox;
import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.platform.SystemInfo;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border; import javax.swing.border.Border;
@ -43,13 +42,18 @@ public class DarkCheckBoxBorder implements Border, UIResource {
final int width, final int height) { final int width, final int height) {
} }
private final Insets insets;
public DarkCheckBoxBorder() {
insets = UIManager.getInsets("CheckBox.borderInsets");
}
@Override @Override
public Insets getBorderInsets(final Component c) { public Insets getBorderInsets(final Component c) {
if (isInCell(c)) { if (isInCell(c)) {
return new Insets(0, 0, 0, 0); return new InsetsUIResource(0, 0, 0, 0);
} }
final int a = SystemInfo.isMac ? 2 : 4; return new InsetsUIResource(insets.top, insets.left, insets.bottom, insets.right);
return new InsetsUIResource(a, a, a, a);
} }
protected static boolean isInCell(final Component c) { protected static boolean isInCell(final Component c) {

26
core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java

@ -35,13 +35,7 @@ import javax.swing.plaf.InsetsUIResource;
import javax.swing.plaf.basic.BasicComboBoxUI; import javax.swing.plaf.basic.BasicComboBoxUI;
import javax.swing.plaf.basic.ComboPopup; import javax.swing.plaf.basic.ComboPopup;
import java.awt.*; import java.awt.*;
import java.awt.event.FocusAdapter; import java.awt.event.*;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Area; import java.awt.geom.Area;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
@ -73,6 +67,7 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements Border, PropertyC
protected Color arrowBackgroundStart; protected Color arrowBackgroundStart;
protected Color arrowBackgroundEnd; protected Color arrowBackgroundEnd;
private Insets boxPadding; private Insets boxPadding;
private Insets cellPadding;
public static ComponentUI createUI(final JComponent c) { public static ComponentUI createUI(final JComponent c) {
@ -83,7 +78,7 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements Border, PropertyC
public void installUI(final JComponent c) { public void installUI(final JComponent c) {
super.installUI(c); super.installUI(c);
comboBox.setBorder(this); comboBox.setBorder(this);
boxPadding = UIManager.getInsets("ComboBox.padding"); boxPadding = UIManager.getInsets("ComboBox.insets");
borderSize = UIManager.getInt("ComboBox.borderThickness"); borderSize = UIManager.getInt("ComboBox.borderThickness");
background = UIManager.getColor("ComboBox.activeBackground"); background = UIManager.getColor("ComboBox.activeBackground");
editBackground = UIManager.getColor("ComboBox.editBackground"); editBackground = UIManager.getColor("ComboBox.editBackground");
@ -94,6 +89,7 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements Border, PropertyC
inactiveBorderColor = UIManager.getColor("ComboBox.inactiveBorderColor"); inactiveBorderColor = UIManager.getColor("ComboBox.inactiveBorderColor");
arrowBackgroundStart = UIManager.getColor("ComboBox.arrowBackgroundStart"); arrowBackgroundStart = UIManager.getColor("ComboBox.arrowBackgroundStart");
arrowBackgroundEnd = UIManager.getColor("ComboBox.arrowBackgroundEnd"); arrowBackgroundEnd = UIManager.getColor("ComboBox.arrowBackgroundEnd");
cellPadding = UIManager.getInsets("ComboBox.cellEditorInsets");
} }
@Override @Override
@ -265,14 +261,14 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements Border, PropertyC
@Override @Override
protected Insets getInsets() { protected Insets getInsets() {
if (isTableCellEditor(comboBox)) { if (isTableCellEditor(comboBox)) {
return new Insets(2, 5, 2, 5); return new InsetsUIResource(cellPadding.top, cellPadding.left, cellPadding.bottom, cellPadding.right);
} }
if (comboBox.getComponentOrientation().isLeftToRight()) { if (comboBox.getComponentOrientation().isLeftToRight()) {
return new InsetsUIResource(borderSize + 4, borderSize + 6, return new InsetsUIResource(borderSize + boxPadding.top, borderSize + boxPadding.left,
borderSize + 4, borderSize); borderSize + boxPadding.bottom, borderSize);
} else { } else {
return new InsetsUIResource(borderSize + 4, borderSize, return new InsetsUIResource(borderSize + boxPadding.top, borderSize,
borderSize + 4, borderSize + 6); borderSize + boxPadding.bottom, borderSize + boxPadding.right);
} }
} }
@ -297,7 +293,6 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements Border, PropertyC
boolean shouldValidate = c instanceof JPanel; boolean shouldValidate = c instanceof JPanel;
Rectangle r = new Rectangle(bounds); Rectangle r = new Rectangle(bounds);
DarkUIUtil.applyInsets(r, boxPadding);
if (isTableCellEditor(comboBox)) { if (isTableCellEditor(comboBox)) {
r.x--; r.x--;
} }
@ -409,7 +404,7 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements Border, PropertyC
@Override @Override
public Insets getBorderInsets(final Component c) { public Insets getBorderInsets(final Component c) {
if (isTableCellEditor(c) || isTreeCellEditor(c)) { if (isTableCellEditor(c) || isTreeCellEditor(c)) {
return new InsetsUIResource(0, 0, 0, 0); return new InsetsUIResource(cellPadding.top, cellPadding.left, cellPadding.bottom, cellPadding.right);
} }
return new InsetsUIResource(borderSize, borderSize, borderSize, borderSize); return new InsetsUIResource(borderSize, borderSize, borderSize, borderSize);
} }
@ -429,7 +424,6 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements Border, PropertyC
if ("componentOrientation".equals(key)) { if ("componentOrientation".equals(key)) {
comboBox.doLayout(); comboBox.doLayout();
comboBox.repaint(); comboBox.repaint();
// editor.setComponentOrientation(comboBox.getComponentOrientation());
} else if ("editable".equals(key)) { } else if ("editable".equals(key)) {
comboBox.repaint(); comboBox.repaint();
} else if ("JComboBox.isTableCellEditor".equals(key) || "JComboBox.isTreeCellEditor".equals(key)) { } else if ("JComboBox.isTableCellEditor".equals(key) || "JComboBox.isTreeCellEditor".equals(key)) {

12
core/src/main/java/com/github/weisj/darklaf/ui/radiobutton/DarkRadioButtonBorder.java

@ -25,7 +25,6 @@ package com.github.weisj.darklaf.ui.radiobutton;
import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.platform.SystemInfo;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border; import javax.swing.border.Border;
@ -44,13 +43,18 @@ public class DarkRadioButtonBorder implements Border, UIResource {
final int width, final int height) { final int width, final int height) {
} }
private final Insets insets;
public DarkRadioButtonBorder() {
insets = UIManager.getInsets("RadioButton.borderInsets");
}
@Override @Override
public Insets getBorderInsets(final Component c) { public Insets getBorderInsets(final Component c) {
if (isInCell(c)) { if (isInCell(c)) {
return new Insets(0, 0, 0, 0); return new InsetsUIResource(0, 0, 0, 0);
} }
final int a = SystemInfo.isMac ? 2 : 4; return new InsetsUIResource(insets.top, insets.left, insets.bottom, insets.right);
return new InsetsUIResource(a, a, a, a);
} }
protected static boolean isInCell(final Component c) { protected static boolean isInCell(final Component c) {

8
core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerBorder.java

@ -43,6 +43,8 @@ public class DarkSpinnerBorder implements Border, UIResource {
protected Color inactiveBorderColor; protected Color inactiveBorderColor;
protected int arc; protected int arc;
protected int borderSize; protected int borderSize;
protected Insets insets;
protected Insets cellInsets;
public DarkSpinnerBorder() { public DarkSpinnerBorder() {
focusBorderColor = UIManager.getColor("Spinner.focusBorderColor"); focusBorderColor = UIManager.getColor("Spinner.focusBorderColor");
@ -50,6 +52,8 @@ public class DarkSpinnerBorder implements Border, UIResource {
inactiveBorderColor = UIManager.getColor("Spinner.inactiveBorderColor"); inactiveBorderColor = UIManager.getColor("Spinner.inactiveBorderColor");
arc = UIManager.getInt("Spinner.arc"); arc = UIManager.getInt("Spinner.arc");
borderSize = UIManager.getInt("Spinner.borderThickness"); borderSize = UIManager.getInt("Spinner.borderThickness");
cellInsets = UIManager.getInsets("Spinner.cellEditorInsets");
insets = UIManager.getInsets("Spinner.insets");
} }
@Override @Override
@ -115,9 +119,9 @@ public class DarkSpinnerBorder implements Border, UIResource {
@Override @Override
public Insets getBorderInsets(final Component c) { public Insets getBorderInsets(final Component c) {
if (DarkSpinnerUI.isTableCellEditor(c) || DarkSpinnerUI.isTreeCellEditor(c)) { if (DarkSpinnerUI.isTableCellEditor(c) || DarkSpinnerUI.isTreeCellEditor(c)) {
return new InsetsUIResource(2, 5, 2, 5); return new InsetsUIResource(cellInsets.top, insets.left, insets.bottom, insets.right);
} }
return new InsetsUIResource(7, 7, 7, 7); return new InsetsUIResource(insets.top, insets.left, insets.bottom, insets.right);
} }
@Override @Override

9
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/MoreTabsButton.java

@ -33,14 +33,15 @@ import java.awt.*;
public class MoreTabsButton extends DarkTabAreaButton { public class MoreTabsButton extends DarkTabAreaButton {
protected final static String INFINITY = "\u221e"; protected final static String INFINITY = "\u221e";
protected final static int PAD = 2;
protected final Icon icon; protected final Icon icon;
protected DarkTabbedPaneUI ui; protected DarkTabbedPaneUI ui;
protected final int pad;
public MoreTabsButton(final DarkTabbedPaneUI ui) { public MoreTabsButton(final DarkTabbedPaneUI ui) {
super(ui); super(ui);
this.ui = ui; this.ui = ui;
icon = ui.getMoreTabsIcon(); icon = ui.getMoreTabsIcon();
pad = UIManager.getInt("TabbedPane.moreTabsButton.pad");
setIcon(EmptyIcon.create(icon.getIconWidth(), icon.getIconHeight())); setIcon(EmptyIcon.create(icon.getIconWidth(), icon.getIconHeight()));
putClientProperty("JButton.variant", "onlyLabel"); putClientProperty("JButton.variant", "onlyLabel");
putClientProperty("JButton.square", true); putClientProperty("JButton.square", true);
@ -57,7 +58,7 @@ public class MoreTabsButton extends DarkTabAreaButton {
FontMetrics metrics = g.getFontMetrics(); FontMetrics metrics = g.getFontMetrics();
String label = getLabelString(); String label = getLabelString();
int labelWidth = metrics.stringWidth(label); int labelWidth = metrics.stringWidth(label);
int x = (getWidth() - (icon.getIconWidth() + labelWidth + PAD)) / 2 + PAD; int x = (getWidth() - (icon.getIconWidth() + labelWidth + pad)) / 2 + pad;
int y = (getHeight() - icon.getIconHeight()) / 2; int y = (getHeight() - icon.getIconHeight()) / 2;
@ -78,7 +79,7 @@ public class MoreTabsButton extends DarkTabAreaButton {
icon.paintIcon(this, g, x, y); icon.paintIcon(this, g, x, y);
config.restore(); config.restore();
config = GraphicsUtil.setupAntialiasing(g); config = GraphicsUtil.setupAntialiasing(g);
g.drawString(label, x + icon.getIconWidth() + PAD, y + icon.getIconHeight() - off); g.drawString(label, x + icon.getIconWidth() + pad, y + icon.getIconHeight() - off);
config.restore(); config.restore();
} }
@ -92,7 +93,7 @@ public class MoreTabsButton extends DarkTabAreaButton {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize(); Dimension size = super.getPreferredSize();
FontMetrics metrics = getFontMetrics(getFont()); FontMetrics metrics = getFontMetrics(getFont());
size.width += metrics.stringWidth(getLabelString()) + 3 * PAD; size.width += metrics.stringWidth(getLabelString()) + 3 * pad;
return size; return size;
} }
} }

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/NewTabButton.java

@ -55,7 +55,7 @@ public class NewTabButton extends JPanel implements UIResource {
button.putClientProperty("JButton.thin", Boolean.TRUE); button.putClientProperty("JButton.thin", Boolean.TRUE);
button.setRolloverEnabled(true); button.setRolloverEnabled(true);
button.setOpaque(false); button.setOpaque(false);
button.setMargin(new Insets(2, 2, 2, 2)); button.setMargin(UIManager.getInsets("TabbedPane.newTabButton.insets"));
return button; return button;
} }

5
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkPanelPopupUI.java

@ -36,7 +36,6 @@ import javax.swing.FocusManager;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.InsetsUIResource;
import javax.swing.plaf.UIResource; import javax.swing.plaf.UIResource;
import java.awt.*; import java.awt.*;
import java.awt.event.AWTEventListener; import java.awt.event.AWTEventListener;
@ -375,10 +374,10 @@ public class DarkPanelPopupUI extends DarkPanelUI implements PropertyChangeListe
putClientProperty("JButton.alternativeArc", Boolean.TRUE); putClientProperty("JButton.alternativeArc", Boolean.TRUE);
putClientProperty("JButton.variant", "shadow"); putClientProperty("JButton.variant", "shadow");
setRolloverEnabled(true); setRolloverEnabled(true);
setMargin(new InsetsUIResource(2, 2, 2, 2)); setMargin(UIManager.getInsets("TabFramePopup.headerButton.insets"));
setFocus(false); setFocus(false);
setOpaque(false); setOpaque(false);
context.setToolTipInsets(new Insets(2, 5, 2, 5)); context.setToolTipInsets(UIManager.getInsets("TabFramePopup.headerButton.tooltipInsets"));
} }
public void setFocus(final boolean focus) { public void setFocus(final boolean focus) {

13
core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextBorder.java

@ -40,7 +40,6 @@ import java.awt.*;
*/ */
public class DarkTextBorder implements Border, UIResource { public class DarkTextBorder implements Border, UIResource {
public final static int PADDING = 4;
private static final Border editorBorder = new TextFieldTableCellEditorBorder(); private static final Border editorBorder = new TextFieldTableCellEditorBorder();
protected Color errorBorderColor; protected Color errorBorderColor;
protected Color focusErrorBorderColor; protected Color focusErrorBorderColor;
@ -52,6 +51,7 @@ public class DarkTextBorder implements Border, UIResource {
protected int arc; protected int arc;
protected int minimumArc; protected int minimumArc;
protected int searchArc; protected int searchArc;
protected Insets padding;
public DarkTextBorder() { public DarkTextBorder() {
focusErrorBorderColor = UIManager.getColor("TextField.border.focusError"); focusErrorBorderColor = UIManager.getColor("TextField.border.focusError");
@ -63,6 +63,7 @@ public class DarkTextBorder implements Border, UIResource {
arc = UIManager.getInt("TextField.arc"); arc = UIManager.getInt("TextField.arc");
searchArc = UIManager.getInt("TextField.searchArc"); searchArc = UIManager.getInt("TextField.searchArc");
minimumArc = UIManager.getInt("TextField.minimumArc"); minimumArc = UIManager.getInt("TextField.minimumArc");
padding = UIManager.getInsets("TextField.insets");
} }
public void paintBorder(final Component c, final Graphics g2, final int x, final int y, public void paintBorder(final Component c, final Graphics g2, final int x, final int y,
@ -161,16 +162,16 @@ public class DarkTextBorder implements Border, UIResource {
if (isCellEditor(c)) { if (isCellEditor(c)) {
return editorBorder.getBorderInsets(c); return editorBorder.getBorderInsets(c);
} }
Insets insets = new Insets(borderSize + PADDING, borderSize + PADDING, Insets insets = new Insets(borderSize + padding.top, borderSize + padding.left,
borderSize + PADDING, borderSize + PADDING); borderSize + padding.bottom, borderSize + padding.right);
if (DarkTextFieldUI.isSearchField(c)) { if (DarkTextFieldUI.isSearchField(c)) {
int searchWidth = DarkTextFieldUI.getSearchIcon(c).getIconWidth(); int searchWidth = DarkTextFieldUI.getSearchIcon(c).getIconWidth();
int clearWidth = DarkTextFieldUI.getClearIcon(false).getIconWidth(); int clearWidth = DarkTextFieldUI.getClearIcon(false).getIconWidth();
insets.left += PADDING + searchWidth; insets.left += padding.left + searchWidth;
insets.right += PADDING + clearWidth; insets.right += padding.right + clearWidth;
} else if (DarkPasswordFieldUI.hasShowIcon(c)) { } else if (DarkPasswordFieldUI.hasShowIcon(c)) {
int eyeWidth = DarkPasswordFieldUI.getShowIcon().getIconWidth(); int eyeWidth = DarkPasswordFieldUI.getShowIcon().getIconWidth();
insets.right += PADDING + eyeWidth; insets.right += padding.right + eyeWidth;
} }
return insets; return insets;
} }

4
core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeCellBorder.java

@ -37,9 +37,11 @@ import java.awt.*;
public class DarkTreeCellBorder implements Border, UIResource { public class DarkTreeCellBorder implements Border, UIResource {
protected Color borderColor; protected Color borderColor;
protected Insets insets;
public DarkTreeCellBorder() { public DarkTreeCellBorder() {
borderColor = UIManager.getColor("Tree.editorBorderColor"); borderColor = UIManager.getColor("Tree.editorBorderColor");
insets = UIManager.getInsets("Tree.editorBorderInsets");
} }
@Override @Override
@ -51,7 +53,7 @@ public class DarkTreeCellBorder implements Border, UIResource {
@Override @Override
public Insets getBorderInsets(final Component c) { public Insets getBorderInsets(final Component c) {
return new InsetsUIResource(2, 5, 2, 5); return new InsetsUIResource(insets.top, insets.left, insets.bottom, insets.right);
} }
@Override @Override

19
core/src/main/java/com/github/weisj/darklaf/util/PropertyLoader.java

@ -35,13 +35,8 @@ import javax.swing.plaf.InsetsUIResource;
import java.awt.*; import java.awt.*;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.*;
import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -125,14 +120,14 @@ public final class PropertyLoader {
} }
Object returnVal = new LoadError(); Object returnVal = new LoadError();
if (key.endsWith("Insets")) { if (key.endsWith("Insets") || key.endsWith(".insets")) {
returnVal = parseInsets(value); returnVal = parseInsets(value);
} else if (!skipObjects } else if (!skipObjects
&& (key.endsWith("Border") && (key.endsWith("Border")
|| key.endsWith(".border") || key.endsWith(".border")
|| key.endsWith(".component") || key.endsWith(".component")
|| key.endsWith("Component") || key.endsWith("Component")
|| key.endsWith("Renderer"))) { || key.endsWith("Renderer"))) {
return new ObjectRequest(key, value); return new ObjectRequest(key, value);
} else if (key.endsWith(".font")) { } else if (key.endsWith(".font")) {
returnVal = parseFont(value); returnVal = parseFont(value);

2
core/src/main/resources/com/github/weisj/darklaf/properties/platform/mac.properties

@ -18,3 +18,5 @@ Table.alternateRowColor = true
Tree.alternateRowColor = true Tree.alternateRowColor = true
List.alternateRowColor = true List.alternateRowColor = true
FileChooser.listViewWindowsStyle = false FileChooser.listViewWindowsStyle = false
CheckBox.borderInsets = 2,2,2,2
RadioButton.borderInsets = 2,2,2,2

4
core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties

@ -52,6 +52,8 @@ Button.borderInsets = 8,16,8,16
Button.thinBorderInsets = 4,8,4,8 Button.thinBorderInsets = 4,8,4,8
Button.squareThinBorderInsets = 4,4,4,4 Button.squareThinBorderInsets = 4,4,4,4
Button.squareBorderInsets = 8,8,8,8 Button.squareBorderInsets = 8,8,8,8
Button.onlyLabelInsets = 0,0,0,0
Button.fullShadowInsets = 0,0,0,0
Button.shadow.hover = %hoverHighlight Button.shadow.hover = %hoverHighlight
Button.shadow.click = %clickHighlight Button.shadow.click = %clickHighlight

3
core/src/main/resources/com/github/weisj/darklaf/properties/ui/checkBox.properties

@ -37,6 +37,7 @@ CheckBox.selectionDisabledColor = %controlFillDisabled
CheckBox.selectionFocusSelectedColor = %controlFillFocus CheckBox.selectionFocusSelectedColor = %controlFillFocus
CheckBox.arc = %arcSecondary CheckBox.arc = %arcSecondary
CheckBox.borderThickness = %borderThickness CheckBox.borderThickness = %borderThickness
CheckBox.borderInsets = 4,4,4,4
#Icons #Icons
CheckBox.unchecked.icon = control/checkBox.svg[themed](19,19) CheckBox.unchecked.icon = control/checkBox.svg[themed](19,19)
@ -47,4 +48,4 @@ CheckBox.indeterminateDisabled.icon = control/checkBoxIndeterminateSelectedDisa
CheckBox.indeterminateFocused.icon = control/checkBoxIndeterminateSelectedFocused.svg[themed](19,19) CheckBox.indeterminateFocused.icon = control/checkBoxIndeterminateSelectedFocused.svg[themed](19,19)
CheckBox.selected.icon = control/checkBoxSelected.svg[themed](19,19) CheckBox.selected.icon = control/checkBoxSelected.svg[themed](19,19)
CheckBox.selectedDisabled.icon = control/checkBoxSelectedDisabled.svg[themed](19,19) CheckBox.selectedDisabled.icon = control/checkBoxSelectedDisabled.svg[themed](19,19)
CheckBox.selectedFocused.icon = control/checkBoxSelectedFocused.svg[themed](19,19) CheckBox.selectedFocused.icon = control/checkBoxSelectedFocused.svg[themed](19,19)

5
core/src/main/resources/com/github/weisj/darklaf/properties/ui/comboBox.properties

@ -39,7 +39,10 @@ ComboBox.selectionBackground = %highlightFillFocus
ComboBox.arc = %arc ComboBox.arc = %arc
ComboBox.borderThickness = %borderThickness ComboBox.borderThickness = %borderThickness
ComboBox.selectionForeground = %textSelectionForeground ComboBox.selectionForeground = %textSelectionForeground
ComboBox.insets = 4,6,4,6
ComboBox.cellEditorInsets = 2,5,2,5
#Icons #Icons
ComboBox.arrow.icon = navigation/arrowDown.svg[themed] ComboBox.arrow.icon = navigation/arrowDown.svg[themed]
ComboBox.arrowInactive.icon = navigation/arrowDownDisabled.svg[themed] ComboBox.arrowInactive.icon = navigation/arrowDownDisabled.svg[themed]

4
core/src/main/resources/com/github/weisj/darklaf/properties/ui/radioButton.properties

@ -37,10 +37,12 @@ RadioButton.selectedBorderColor = %controlBorderSelected
RadioButton.activeBorderColor = %controlBorder RadioButton.activeBorderColor = %controlBorder
RadioButton.inactiveBorderColor = %controlBorderDisabled RadioButton.inactiveBorderColor = %controlBorderDisabled
RadioButton.borderInsets = 4,4,4,4
#Icons #Icons
RadioButton.unchecked.icon = control/radio.svg[themed](19,19) RadioButton.unchecked.icon = control/radio.svg[themed](19,19)
RadioButton.uncheckedDisabled.icon = control/radioDisabled.svg[themed](19,19) RadioButton.uncheckedDisabled.icon = control/radioDisabled.svg[themed](19,19)
RadioButton.uncheckedFocused.icon = control/radioFocused.svg[themed](19,19) RadioButton.uncheckedFocused.icon = control/radioFocused.svg[themed](19,19)
RadioButton.selected.icon = control/radioSelected.svg[themed](19,19) RadioButton.selected.icon = control/radioSelected.svg[themed](19,19)
RadioButton.selectedDisabled.icon = control/radioSelectedDisabled.svg[themed](19,19) RadioButton.selectedDisabled.icon = control/radioSelectedDisabled.svg[themed](19,19)
RadioButton.selectedFocused.icon = control/radioSelectedFocused.svg[themed](19,19) RadioButton.selectedFocused.icon = control/radioSelectedFocused.svg[themed](19,19)

5
core/src/main/resources/com/github/weisj/darklaf/properties/ui/spinner.properties

@ -38,6 +38,9 @@ Spinner.arrowButtonBorder = null
Spinner.arc = %arc Spinner.arc = %arc
Spinner.borderThickness = %borderThickness Spinner.borderThickness = %borderThickness
Spinner.cellEditorInsets = 2, 5, 2, 5
Spinner.insets = 7, 7, 7, 7
Spinner.plus.icon = misc/plus.svg[themed] Spinner.plus.icon = misc/plus.svg[themed]
Spinner.plusInactive.icon = misc/plus.svg[themed] Spinner.plusInactive.icon = misc/plus.svg[themed]
Spinner.minus.icon = misc/minus.svg[themed] Spinner.minus.icon = misc/minus.svg[themed]
@ -45,4 +48,4 @@ Spinner.minusInactive.icon = misc/minus.svg[themed]
Spinner.arrowUp.icon = navigation/arrowUp.svg[themed] Spinner.arrowUp.icon = navigation/arrowUp.svg[themed]
Spinner.arrowUpInactive.icon = navigation/arrowUpDisabled.svg[themed] Spinner.arrowUpInactive.icon = navigation/arrowUpDisabled.svg[themed]
Spinner.arrowDown.icon = navigation/arrowDown.svg[themed] Spinner.arrowDown.icon = navigation/arrowDown.svg[themed]
Spinner.arrowDownInactive.icon = navigation/arrowDownDisabled.svg[themed] Spinner.arrowDownInactive.icon = navigation/arrowDownDisabled.svg[themed]

2
core/src/main/resources/com/github/weisj/darklaf/properties/ui/tabFrame.properties

@ -42,6 +42,8 @@ TabFramePopup.headerButtonFocusClickBackground = %clickHighlightColorful
TabFramePopup.closeAccelerator = shift pressed ESCAPE TabFramePopup.closeAccelerator = shift pressed ESCAPE
TabFramePopup.closeTooltipText = Close (shift ESC) TabFramePopup.closeTooltipText = Close (shift ESC)
TabFramePopup.headerButton.tooltipInsets = 2,5,2,5
TabFramePopup.headerButton.insets = 2,2,2,2
TabFramePopup.minimumHeaderSize = null TabFramePopup.minimumHeaderSize = null
TabFramePopup.borderColor = %border TabFramePopup.borderColor = %border

5
core/src/main/resources/com/github/weisj/darklaf/properties/ui/tabbedPane.properties

@ -47,7 +47,10 @@ TabbedPane.tabsOverlapBorder = false
TabbedPane.labelShift = 0 TabbedPane.labelShift = 0
TabbedPane.selectedLabelShift = 0 TabbedPane.selectedLabelShift = 0
TabbedPane.selectedTabPadInsets = 0,0,0,0 TabbedPane.selectedTabPadInsets = 0,0,0,0
TabbedPane.tabAreaInsets = 0,0,0,0 TabbedPane.tabAreaInsets = 0,0,0,
TabbedPane.newTabButton.insets = 2,2,2,2
TabbedPane.moreTabsButton.pad = 2
#Icons #Icons
TabbedPane.newTab.icon = navigation/add.svg[themed] TabbedPane.newTab.icon = navigation/add.svg[themed]

3
core/src/main/resources/com/github/weisj/darklaf/properties/ui/text.properties

@ -40,6 +40,7 @@ TextField.inactiveBackground = %textBackgroundInactive
TextField.background = %textBackground TextField.background = %textBackground
TextField.selectionBackground = %textSelectionBackground TextField.selectionBackground = %textSelectionBackground
TextField.selectionForeground = %textSelectionForeground TextField.selectionForeground = %textSelectionForeground
TextField.insets = 4,4,4,4
TextField.arc = %arcSecondary TextField.arc = %arcSecondary
TextField.minimumArc = %arcSecondary TextField.minimumArc = %arcSecondary
@ -96,4 +97,4 @@ PasswordField.showPressed.icon = misc/eyeHovered.svg[themed]
TextField.search.searchWithHistory.icon = navigation/searchWithHistory.svg[themed] TextField.search.searchWithHistory.icon = navigation/searchWithHistory.svg[themed]
TextField.search.search.icon = navigation/search.svg[themed] TextField.search.search.icon = navigation/search.svg[themed]
TextField.search.clear.icon = navigation/close.svg[themed] TextField.search.clear.icon = navigation/close.svg[themed]
TextField.search.clearHover.icon = navigation/closeHovered.svg[themed] TextField.search.clearHover.icon = navigation/closeHovered.svg[themed]

4
core/src/main/resources/com/github/weisj/darklaf/properties/ui/tree.properties

@ -49,6 +49,8 @@ Tree.alternateRowBackground = %backgroundAlternative
Tree.renderBooleanAsCheckBox = true Tree.renderBooleanAsCheckBox = true
Tree.booleanRenderType = checkBox Tree.booleanRenderType = checkBox
Tree.editorBorderInsets = 2,5,2,5
#Icons #Icons
Tree.collapsedIcon = navigation/arrowRight.svg[themed] Tree.collapsedIcon = navigation/arrowRight.svg[themed]
Tree.expandedIcon = navigation/arrowDown.svg[themed] Tree.expandedIcon = navigation/arrowDown.svg[themed]
@ -63,4 +65,4 @@ Tree.collapsed.unselected.unfocused.icon = navigation/arrowRight.svg[themed]
Tree.expanded.selected.focused.icon = navigation/arrowDownSelected.svg[themed] Tree.expanded.selected.focused.icon = navigation/arrowDownSelected.svg[themed]
Tree.expanded.selected.unfocused.icon = navigation/arrowDown.svg[themed] Tree.expanded.selected.unfocused.icon = navigation/arrowDown.svg[themed]
Tree.expanded.unselected.focused.icon = navigation/arrowDown.svg[themed] Tree.expanded.unselected.focused.icon = navigation/arrowDown.svg[themed]
Tree.expanded.unselected.unfocused.icon = navigation/arrowDown.svg[themed] Tree.expanded.unselected.unfocused.icon = navigation/arrowDown.svg[themed]

Loading…
Cancel
Save