Exemplo n.º 1
0
  /**
   * DOCUMENT ME!
   *
   * @return DOCUMENT ME!
   */
  public Icon getIcon(final Object value) {
    final NodeIcon icon =
        new NodeIcon() {
          public void paintIcon(Component c, Graphics g, int x, int y) {
            super.setColor(new Color(10, 10, 10, 25));
            super.paintIcon(c, g, x, y);
            g2d.setFont(new Font("SansSerif", Font.BOLD, 24));
            g2d.setColor(Color.DARK_GRAY);
            g2d.drawString(value.toString(), c.getX() + 7, (int) ((c.getHeight() / 2) + 7));
            g2d.setFont(new Font("SansSerif", Font.BOLD, 12));
          }
        };

    icon.setBottomPadding(-2);

    return icon;
  }
Exemplo n.º 2
0
  /**
   * DOCUMENT ME!
   *
   * @return DOCUMENT ME!
   */
  public Icon getIcon(final Object value) {
    final NodeIcon icon =
        new NodeIcon() {
          public void paintIcon(Component c, Graphics g, int x, int y) {
            super.setColor(new Color(10, 10, 10, 25));
            super.paintIcon(c, g, x, y);
            g2d.setFont(new Font("SansSerif", Font.BOLD, 8));
            g2d.setColor(Color.DARK_GRAY);

            String defLabel = value.toString();
            if (defLabel.length() > 15) {
              defLabel = defLabel.substring(0, 14) + "...";
            }
            g2d.drawString(defLabel, c.getX() + 7, (int) ((c.getHeight() / 2)));
            g2d.setFont(new Font("SansSerif", Font.BOLD, 12));
          }
        };

    icon.setBottomPadding(-2);

    return icon;
  }