@Override
    protected void paintComponent(Graphics g) {
      setFont(UIManager.getFont("Table.font"));
      g.setColor(myColor);

      int width = getWidth();

      if (isNarrow) {
        g.fillRect(0, 0, width - ROOT_INDICATOR_WHITE_WIDTH, myUi.getTable().getRowHeight());
        g.setColor(myBorderColor);
        g.fillRect(
            width - ROOT_INDICATOR_WHITE_WIDTH,
            0,
            ROOT_INDICATOR_WHITE_WIDTH,
            myUi.getTable().getRowHeight());
      } else {
        g.fillRect(0, 0, width, myUi.getTable().getRowHeight());
      }

      super.paintComponent(g);
    }
Пример #2
0
 private static Icon createColoredIcon(Color color) {
   Icon icon = icons_cache.get(color);
   if (icon != null) return icon;
   final BufferedImage image =
       GraphicsEnvironment.getLocalGraphicsEnvironment()
           .getDefaultScreenDevice()
           .getDefaultConfiguration()
           .createCompatibleImage(16, 16, Color.TRANSLUCENT);
   final Graphics g = image.getGraphics();
   g.setColor(color);
   g.fillRect(0, 0, 16, 16);
   g.dispose();
   icon = new ImageIcon(image);
   icons_cache.put(color, icon);
   return icon;
 }