Ejemplo n.º 1
0
    @Override
    public void paintComponent(Graphics g) {
      super.paintComponent(g);

      AnAction action = getAction();
      if (action instanceof ActivateCard) {
        Rectangle bounds = getBounds();

        Icon icon = AllIcons.Actions.Forward; // AllIcons.Icons.Ide.NextStepGrayed;
        int y = (bounds.height - icon.getIconHeight()) / 2;
        int x = bounds.width - icon.getIconWidth() - 15;

        if (getPopState() == POPPED) {
          final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
          g.setColor(WelcomeScreenColors.CAPTION_BACKGROUND);
          g.fillOval(x - 3, y - 3, icon.getIconWidth() + 6, icon.getIconHeight() + 6);

          g.setColor(WelcomeScreenColors.GROUP_ICON_BORDER_COLOR);
          g.drawOval(x - 3, y - 3, icon.getIconWidth() + 6, icon.getIconHeight() + 6);
          config.restore();
        } else {
          icon = IconLoader.getDisabledIcon(icon);
        }

        icon.paintIcon(this, g, x, y);
      }
    }
Ejemplo n.º 2
0
 @Override
 public void paintIcon(Component c, Graphics g, int x, int y) {
   g.setColor(LightColors.SLIGHTLY_GREEN);
   g.fillRoundRect(x + 4, y + 4, 32 - 8, 32 - 8, 8, 8);
   g.setColor(Color.GRAY);
   g.drawRoundRect(x + 4, y + 4, 32 - 8, 32 - 8, 8, 8);
 }
  public void paintComponent(Graphics g) {
    Icon icon = getIcon();
    FontMetrics fm = getFontMetrics(getFont());
    Rectangle viewRect = new Rectangle(getSize());
    JBInsets.removeFrom(viewRect, getInsets());

    Rectangle iconRect = new Rectangle();
    Rectangle textRect = new Rectangle();
    String text =
        SwingUtilities.layoutCompoundLabel(
            this,
            fm,
            getText(),
            icon,
            SwingConstants.CENTER,
            horizontalTextAlignment(),
            SwingConstants.CENTER,
            horizontalTextPosition(),
            viewRect,
            iconRect,
            textRect,
            iconTextSpace());
    ActionButtonLook look = ActionButtonLook.IDEA_LOOK;
    look.paintBackground(g, this);
    look.paintIconAt(g, this, icon, iconRect.x, iconRect.y);
    look.paintBorder(g, this);

    UISettings.setupAntialiasing(g);
    g.setColor(isButtonEnabled() ? getForeground() : getInactiveTextColor());
    SwingUtilities2.drawStringUnderlineCharAt(
        this, g, text, getMnemonicCharIndex(text), textRect.x, textRect.y + fm.getAscent());
  }
Ejemplo n.º 4
0
 @Override
 protected void paintComponent(@NotNull Graphics g) {
   super.paintComponent(g);
   if (UIUtil.isUnderDarcula()) {
     g.setColor(UIUtil.getControlColor().brighter());
     g.fillRect(0, 0, getWidth(), getHeight());
   }
 }
 @Override
 public void paintBorder(
     final Component c,
     final Graphics g,
     final int x,
     final int y,
     final int width,
     final int height) {
   if (UIUtil.isUnderDarcula()) {
     g.setColor(Gray._40);
     doPaintBorder(c, g, x, y, width, height);
   } else {
     g.setColor(UIUtil.getPanelBackground());
     doPaintBorder(c, g, x, y, width, height);
     g.setColor(Gray._155);
     doPaintBorder(c, g, x, y, width, height);
   }
 }
    @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);
    }
Ejemplo n.º 7
0
 @Override
 protected void paintComponent(Graphics g) {
   g.setColor(myColor);
   g.fillRect(0, 0, ROOT_INDICATOR_WIDTH - 1, HEIGHT_CELL);
   UIUtil.drawLine(
       (Graphics2D) g,
       ROOT_INDICATOR_WIDTH - 1,
       0,
       ROOT_INDICATOR_WIDTH - 1,
       HEIGHT_CELL,
       null,
       myUi.getColorManager().getRootIndicatorBorder());
 }
Ejemplo n.º 8
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;
 }
Ejemplo n.º 9
0
  private void paintBackgroundAndFoldingLine(Graphics g, Rectangle clipBounds) {
    Graphics2D g2d = (Graphics2D) g;
    g.setColor(getBackground());
    g.fillRect(
        clipBounds.x,
        clipBounds.y,
        Math.min(clipBounds.width, myFoldingLineX - clipBounds.x),
        clipBounds.height);
    g.setColor(getEditorComponent().getBackground());
    g.fillRect(
        Math.max(clipBounds.x, myFoldingLineX),
        clipBounds.y,
        clipBounds.width - Math.max(0, myFoldingLineX - clipBounds.x),
        clipBounds.height);

    // same as in EditorComponent.paint() method
    EditorCell deepestCell = myEditorComponent.getDeepestSelectedCell();
    if (deepestCell instanceof EditorCell_Label) {
      int selectedCellY = deepestCell.getY();
      int selectedCellHeight =
          deepestCell.getHeight() - deepestCell.getTopInset() - deepestCell.getBottomInset();
      if (g.hitClip(clipBounds.x, selectedCellY, clipBounds.width, selectedCellHeight)) {
        g.setColor(EditorComponent.CARET_ROW_COLOR);
        g.fillRect(clipBounds.x, selectedCellY, clipBounds.width, selectedCellHeight);
        // Drawing folding line
        UIUtil.drawVDottedLine(
            g2d,
            myFoldingLineX,
            clipBounds.y,
            selectedCellY,
            getBackground(),
            EditorColorsManager.getInstance()
                .getGlobalScheme()
                .getColor(EditorColors.TEARLINE_COLOR));
        UIUtil.drawVDottedLine(
            g2d,
            myFoldingLineX,
            selectedCellY,
            selectedCellY + selectedCellHeight,
            EditorComponent.CARET_ROW_COLOR,
            EditorColorsManager.getInstance()
                .getGlobalScheme()
                .getColor(EditorColors.TEARLINE_COLOR));
        UIUtil.drawVDottedLine(
            g2d,
            myFoldingLineX,
            selectedCellY + selectedCellHeight,
            clipBounds.y + clipBounds.height,
            getBackground(),
            EditorColorsManager.getInstance()
                .getGlobalScheme()
                .getColor(EditorColors.TEARLINE_COLOR));
        return;
      }
    }
    // Drawing folding line
    // COLORS: Remove hardcoded color
    UIUtil.drawVDottedLine(
        g2d,
        myFoldingLineX,
        clipBounds.y,
        clipBounds.y + clipBounds.height,
        getBackground(),
        Color.gray);
  }