Java 8 IconUIResource - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 IconUIResource class.

This code example shows how to use the following methods:
      initIdeaDefaults(defaults);
      patchStyledEditorKit(); 
      patchComboBox(metalDefaults, defaults);
      defaults.remove("Spinner.arrowButtonBorder");
      defaults.put("Spinner.arrowButtonSize", new Dimension(16, 5));
      defaults.put("Tree.collapsedIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/treeNodeCollapsed.png")));
      defaults.put("Tree.expandedIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/treeNodeExpanded.png")));
      defaults.put("CheckBoxMenuItem.checkIcon", EmptyIcon.create(16));
      defaults.put("RadioButtonMenuItem.checkIcon", EmptyIcon.create(16));
      defaults.put("InternalFrame.icon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/internalFrame.png")));
      return defaults;
    } 
    catch (Exception ignore) {
      log(ignore);
    } 
    return super.getDefaults(); 
  } 
 
  private static void patchComboBox(UIDefaults metalDefaults, UIDefaults defaults) {
    defaults.remove("ComboBox.ancestorInputMap");
3
CodeRank
This code example shows how to use the following methods:
    return color == null ? defaultValue : color; 
  } 
 
  @Override 
  public Icon getDefaultIcon() {
    return new IconUIResource(EmptyIcon.create(20));
  } 
} 
3
CodeRank
This code example shows how to use the following methods:
      if (color != null) { 
        return  new ColorUIResource(color);
      } else if (invVal != null) {
        return invVal;
      } else if (icon != null) {
        return new IconUIResource(icon);
      } else if (boolVal != null) {
        return boolVal;
      } 
    } 
    return value;
  } 
 
  @SuppressWarnings("UseJBColor") 
  private static Color parseColor(String value) {
    if (value != null && value.length() == 8) {
      final Color color = ColorUtil.fromHex(value.substring(0, 6));
      if (color != null) { 
        try { 
          int alpha = Integer.parseInt(value.substring(6, 8), 16);
3
CodeRank
This code example shows how to use the following methods:
    } 
  } 
 
  @Override 
  public Icon getDefaultIcon() {
    return new IconUIResource(EmptyIcon.create(20));
  } 
} 
3
CodeRank
This code example shows how to use the following methods:
      if (color != null) { 
        return  new ColorUIResource(color);
      } else if (invVal != null) {
        return invVal;
      } else if (icon != null) {
        return new IconUIResource(icon);
      } else if (boolVal != null) {
        return boolVal;
      } 
    } 
    return value;
  } 
 
  @SuppressWarnings("UseJBColor") 
  private static Color parseColor(String value) {
    if (value != null && value.length() == 8) {
      final Color color = ColorUtil.fromHex(value.substring(0, 6));
      if (color != null) { 
        try { 
          int alpha = Integer.parseInt(value.substring(6, 8), 16);
3
CodeRank
This code example shows how to use the following methods:
    return color == null ? defaultValue : color; 
  } 
 
  @Override 
  public Icon getDefaultIcon() {
    return new IconUIResource(EmptyIcon.create(20));
  } 
} 
4
CodeRank
This code example shows how to use the following methods:
    return color == null ? defaultValue : color; 
  } 
 
  @Override 
  public Icon getDefaultIcon() {
    return new IconUIResource(EmptyIcon.create(20));
  } 
} 
4
CodeRank
This code example shows how to use the following methods:
                graphics.drawLine(0, 0, image.getWidth(), image.getHeight());
 
                // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced 
                JButton button1 = new JButton(new IconUIResource(new ImageIcon(image)));
 
                JButton button2 = new JButton(new IconUIResource(new ImageIcon(image)));
 
                button2.setEnabled(false);
 
                if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) {
                    fail("Two similar buttons have different size"); 
                } 
            } 
        }); 
    } 
 
    private static void fail(String s) {
        throw new RuntimeException("Test failed: " + s);
    } 
} 
4
CodeRank
This code example shows how to use the following methods:
    } 
  } 
 
  @Override 
  public Icon getDefaultIcon() {
    return new IconUIResource(EmptyIcon.create(20));
  } 
} 
4
CodeRank
This code example shows how to use the following methods:
    public static Icon brighten(Icon icon) {
        Image img = getImage(icon);
        if(img == null)
            return icon;
        img = brighten(img);
        return new IconUIResource(new ImageIcon(img));
    } 
     
    /** 
     * Returns a slightly darker version of the icon. 
     */ 
    public static Icon darken(Icon icon) {
        Image img = getImage(icon);
        if(img == null)
            return icon;
        img = darken(img);
        return new IconUIResource(new ImageIcon(img));
    } 
     
    /** 
4
CodeRank
See Code Examples for Java 8 IconUIResource Methods: