@Override public Object createValue(UIDefaults table) { return new BorderUIResource.CompoundBorderUIResource( new SubstanceTextComponentBorder(SubstanceSizeUtils .getSpinnerBorderInsets(SubstanceSizeUtils .getControlFontSize())), new BasicBorders.MarginBorder()); } };
@Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { paintBorder((JComponent) c, g, x, y, width, height, c.isEnabled(), c .hasFocus()); }
@Override public Object createValue(UIDefaults table) { return new BorderUIResource.CompoundBorderUIResource( new SubstanceTextComponentBorder( SubstanceSizeUtils .getTextBorderInsets(SubstanceSizeUtils .getControlFontSize())), new BasicBorders.MarginBorder()); } };
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { paintBorder((JComponent) c, g, x, y, width, height, c.isEnabled(), c .hasFocus()); }
@Override public Object createValue(UIDefaults table) { return new BorderUIResource.CompoundBorderUIResource( new SubstanceTextComponentBorder(SubstanceSizeUtils .getTextBorderInsets(SubstanceSizeUtils .getControlFontSize())), new BasicBorders.MarginBorder()); } };
@Override public Object createValue(UIDefaults table) { return new BorderUIResource.CompoundBorderUIResource( new SubstanceTextComponentBorder( SubstanceSizeUtils .getSpinnerBorderInsets(SubstanceSizeUtils .getControlFontSize())), new BasicBorders.MarginBorder()); } };
if (b == null || b instanceof UIResource) { Border newB = new BorderUIResource.CompoundBorderUIResource( new SubstanceTextComponentBorder(SubstanceSizeUtils .getTextBorderInsets(SubstanceSizeUtils .getComponentFontSize(this.textField))),
if (b == null || b instanceof UIResource) { Border newB = new BorderUIResource.CompoundBorderUIResource( new SubstanceTextComponentBorder(SubstanceSizeUtils .getTextBorderInsets(SubstanceSizeUtils .getComponentFontSize(this.textField))),
if (b == null || b instanceof UIResource) { Border newB = new BorderUIResource.CompoundBorderUIResource( new SubstanceTextComponentBorder(SubstanceSizeUtils .getTextBorderInsets(SubstanceSizeUtils .getComponentFontSize(this.textField))),
if (b == null || b instanceof UIResource) { Border newB = new BorderUIResource.CompoundBorderUIResource( new SubstanceTextComponentBorder(SubstanceSizeUtils .getTextBorderInsets(SubstanceSizeUtils .getComponentFontSize(this.textField))),
if (b == null || b instanceof UIResource) { Border newB = new BorderUIResource.CompoundBorderUIResource( new SubstanceTextComponentBorder(SubstanceSizeUtils .getTextBorderInsets(SubstanceSizeUtils .getComponentFontSize(this.passwordField))),
if (b == null || b instanceof UIResource) { Border newB = new BorderUIResource.CompoundBorderUIResource( new SubstanceTextComponentBorder(SubstanceSizeUtils .getTextBorderInsets(SubstanceSizeUtils .getComponentFontSize(this.passwordField))),
@Override protected void installDefaults() { super.installDefaults(); Border b = this.datePicker.getBorder(); if (b == null || b instanceof UIResource) { int fontSize = SubstanceSizeUtils .getComponentFontSize(this.datePicker); Insets borderInsets = SubstanceSizeUtils .getComboBorderInsets(fontSize); this.datePicker.setBorder(new SubstanceTextComponentBorder( borderInsets)); this.layoutInsets = SubstanceSizeUtils .getComboLayoutInsets(fontSize); } this.datePicker.setOpaque(false); }
private void updateComboBoxBorder() { Border b = this.comboBox.getBorder(); if (b == null || b instanceof UIResource) { int comboFontSize = SubstanceSizeUtils .getComponentFontSize(this.comboBox); Insets comboBorderInsets = SubstanceSizeUtils .getComboBorderInsets(comboFontSize); if (this.comboBox.isEditable()) { this.comboBox.setBorder(new SubstanceTextComponentBorder( comboBorderInsets)); } else { this.comboBox .setBorder(new BorderUIResource.EmptyBorderUIResource( comboBorderInsets)); // BasicComboBoxUI does not invalidate display size when // combo becomes uneditable. However, this is not good // in Substance which has different preferred size for // editable and uneditable combos. Calling the method below // will trigger the path in BasicComboBoxUI.Handler that // will invalidate the cached sizes. this.comboBox.setPrototypeDisplayValue(this.comboBox .getPrototypeDisplayValue()); } this.layoutInsets = SubstanceSizeUtils .getComboLayoutInsets(comboFontSize); } else { this.layoutInsets = new Insets(0, 0, 0, 0); } }
private void updateComboBoxBorder() { Border b = this.comboBox.getBorder(); if (b == null || b instanceof UIResource) { int comboFontSize = SubstanceSizeUtils .getComponentFontSize(this.comboBox); Insets comboBorderInsets = SubstanceSizeUtils .getComboBorderInsets(comboFontSize); if (this.comboBox.isEditable()) { this.comboBox.setBorder(new SubstanceTextComponentBorder( comboBorderInsets)); } else { this.comboBox .setBorder(new BorderUIResource.EmptyBorderUIResource( comboBorderInsets)); // BasicComboBoxUI does not invalidate display size when // combo becomes uneditable. However, this is not good // in Substance which has different preferred size for // editable and uneditable combos. Calling the method below // will trigger the path in BasicComboBoxUI.Handler that // will invalidate the cached sizes. this.comboBox.setPrototypeDisplayValue(this.comboBox .getPrototypeDisplayValue()); } this.layoutInsets = SubstanceSizeUtils .getComboLayoutInsets(comboFontSize); } else { this.layoutInsets = new Insets(0, 0, 0, 0); } }
@Override protected void installDefaults() { super.installDefaults(); JComponent editor = this.spinner.getEditor(); if ((editor != null) && (editor instanceof JSpinner.DefaultEditor)) { JTextField tf = ((JSpinner.DefaultEditor) editor).getTextField(); if (tf != null) { int fontSize = SubstanceSizeUtils .getComponentFontSize(this.spinner); Insets ins = SubstanceSizeUtils .getSpinnerTextBorderInsets(fontSize); tf.setBorder(new EmptyBorder(ins.top, ins.left, ins.bottom, ins.right)); tf.setFont(spinner.getFont()); tf.setOpaque(false); } } if (editor != null) { editor.setOpaque(false); } Border b = this.spinner.getBorder(); if (b == null || b instanceof UIResource) { this.spinner.setBorder(new SubstanceTextComponentBorder( SubstanceSizeUtils .getSpinnerBorderInsets(SubstanceSizeUtils .getComponentFontSize(this.spinner)))); } }
@Override protected void installDefaults() { super.installDefaults(); JComponent editor = this.spinner.getEditor(); if ((editor != null) && (editor instanceof JSpinner.DefaultEditor)) { JTextField tf = ((JSpinner.DefaultEditor) editor).getTextField(); if (tf != null) { int fontSize = SubstanceSizeUtils .getComponentFontSize(this.spinner); Insets ins = SubstanceSizeUtils .getSpinnerTextBorderInsets(fontSize); tf.setBorder(new EmptyBorder(ins.top, ins.left, ins.bottom, ins.right)); tf.setFont(spinner.getFont()); tf.setOpaque(false); } } if (editor != null) { editor.setOpaque(false); } Border b = this.spinner.getBorder(); if (b == null || b instanceof UIResource) { this.spinner.setBorder(new SubstanceTextComponentBorder( SubstanceSizeUtils .getSpinnerBorderInsets(SubstanceSizeUtils .getComponentFontSize(this.spinner)))); } }