Java Code Examples for javax.swing.plaf.BorderUIResource#CompoundBorderUIResource

The following examples show how to use javax.swing.plaf.BorderUIResource#CompoundBorderUIResource . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SubstancePasswordFieldUI.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void installDefaults() {
    super.installDefaults();
    Border b = this.passwordField.getBorder();
    if (b == null || b instanceof UIResource) {
        Border newB = new BorderUIResource.CompoundBorderUIResource(
                new SubstanceTextComponentBorder(SubstanceSizeUtils.getTextBorderInsets(
                        SubstanceSizeUtils.getComponentFontSize(this.passwordField))),
                new BasicBorders.MarginBorder());
        this.passwordField.setBorder(newB);
    }

    // support for per-window skins
    SwingUtilities.invokeLater(() -> {
        if (passwordField == null)
            return;
        Color foregr = passwordField.getForeground();
        if ((foregr == null) || (foregr instanceof UIResource)) {
            passwordField.setForeground(SubstanceColorUtilities.getForegroundColor(
                    SubstanceCortex.ComponentScope.getCurrentSkin(passwordField)
                            .getEnabledColorScheme(ComponentOrParentChainScope
                                    .getDecorationType(passwordField))));
        }
    });
    for (SubstanceWidget lafWidget : this.lafWidgets) {
        lafWidget.installDefaults();
    }
}
 
Example 2
Source File: SubstanceFormattedTextFieldUI.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void installDefaults() {
    super.installDefaults();
    Border b = this.textField.getBorder();
    if (b == null || b instanceof UIResource) {
        Border newB = new BorderUIResource.CompoundBorderUIResource(
                new SubstanceTextComponentBorder(SubstanceSizeUtils.getTextBorderInsets(
                        SubstanceSizeUtils.getComponentFontSize(this.textField))),
                new BasicBorders.MarginBorder());
        this.textField.setBorder(newB);
    }

    // support for per-window skins
    SwingUtilities.invokeLater(() -> {
        if (textField == null) {
            return;
        }
        Color foregr = textField.getForeground();
        if ((foregr == null) || (foregr instanceof UIResource)) {
            textField.setForeground(SubstanceColorUtilities
                    .getForegroundColor(SubstanceCortex.ComponentScope.getCurrentSkin(textField)
                            .getEnabledColorScheme(ComponentOrParentChainScope
                                    .getDecorationType(textField))));
        }
    });
    for (SubstanceWidget lafWidget : this.lafWidgets) {
        lafWidget.installDefaults();
    }
}
 
Example 3
Source File: SubstanceTextFieldUI.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void installDefaults() {
    super.installDefaults();
    Border b = this.textField.getBorder();
    if (b == null || b instanceof UIResource) {
        Border newB = new BorderUIResource.CompoundBorderUIResource(
                new SubstanceTextComponentBorder(SubstanceSizeUtils.getTextBorderInsets(
                        SubstanceSizeUtils.getComponentFontSize(this.textField))),
                new BasicBorders.MarginBorder());
        this.textField.setBorder(newB);
    }

    // support for per-window skins
    SwingUtilities.invokeLater(() -> {
        if (textField == null)
            return;
        Color foregr = textField.getForeground();
        if ((foregr == null) || (foregr instanceof UIResource)) {
            textField.setForeground(SubstanceColorUtilities
                    .getForegroundColor(SubstanceCortex.ComponentScope.getCurrentSkin(textField)
                            .getEnabledColorScheme(ComponentOrParentChainScope
                                    .getDecorationType(textField))));
        }
    });
    for (SubstanceWidget lafWidget : this.lafWidgets) {
        lafWidget.installDefaults();
    }
}
 
Example 4
Source File: UIUtilities.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Set up the user interface.
 */
public static void setupUI() {
    try {
        final String classname = UIManager.getSystemLookAndFeelClassName();
        UIManager.setLookAndFeel(classname);
    }
    catch (Exception e) { 
        e.printStackTrace();
    }

    final UIDefaults defaults = UIManager.getDefaults();

    defaults.put(
        "PopupMenu.border", 
        new BorderUIResource.EtchedBorderUIResource(
            EtchedBorder.RAISED, defaults.getColor("controlShadow"), 
            defaults.getColor("controlLtHighlight")
        )
    );

    final MatteBorder matteborder = new MatteBorder(1, 1, 1, 1, Color.black);
    final EmptyBorder emptyborder = new MatteBorder(2, 2, 2, 2, defaults.getColor("control"));
    final BorderUIResource.CompoundBorderUIResource compBorder
        = new BorderUIResource.CompoundBorderUIResource(emptyborder, matteborder);
    final BorderUIResource.EmptyBorderUIResource emptyBorderUI
        = new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0);
    defaults.put("SplitPane.border", emptyBorderUI);
    defaults.put("Table.scrollPaneBorder", emptyBorderUI);
    defaults.put("ComboBox.border", compBorder);
    defaults.put("TextField.border", compBorder);
    defaults.put("TextArea.border", compBorder);
    defaults.put("CheckBox.border", compBorder);
    defaults.put("ScrollPane.border", emptyBorderUI);

}
 
Example 5
Source File: BegBorders.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static Border getButtonBorder() {
  if (ourButtonBorder == null) {
    ourButtonBorder = new BorderUIResource.CompoundBorderUIResource(
      new ButtonBorder(),
      new BasicBorders.MarginBorder());
  }
  return ourButtonBorder;
}
 
Example 6
Source File: BegBorders.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static Border getTextFieldBorder() {
  if (ourTextFieldBorder == null) {
    ourTextFieldBorder = new BorderUIResource.CompoundBorderUIResource(
      new TextFieldBorder(),
      //new FlatLineBorder(),
      BorderFactory.createEmptyBorder(2, 2, 2, 2));
  }
  return ourTextFieldBorder;
}