示例#1
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;
 }
示例#2
0
    @Override
    protected void paintComponent(Graphics g) {
      super.paintComponent(g);

      int count = getComponentCount() - 1;
      if (count > 0) {
        int x2 = getWidth() - JBUI.scale(16);
        int y = 0;

        g.setColor(new JBColor(0xD0D0D0, 0x717375));

        for (int i = 0; i < count; i++) {
          Dimension size = getComponent(i).getPreferredSize();
          y += size.height + 1;
          g.drawLine(JBUI.scale(16), y, x2, y);
        }
      }
    }
    public void paint(Graphics g) {
      super.paint(g);

      if (myResizable && myDrawMacCorner) {
        g.drawImage(
            ourMacCorner,
            getX() + getWidth() - ourMacCorner.getWidth(this),
            getY() + getHeight() - ourMacCorner.getHeight(this),
            this);
      }
    }
    @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);
    }