com.intellij.ui.Gray Java Examples

The following examples show how to use com.intellij.ui.Gray. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RunAnythingUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
static JComponent createTitle(@Nonnull String titleText, @Nonnull Color background) {
  JLabel titleLabel = new JLabel(StringUtil.capitalizeWords(titleText, true));
  titleLabel.setFont(getTitleFont());
  titleLabel.setForeground(UIUtil.getLabelDisabledForeground());

  SeparatorComponent separatorComponent = new SeparatorComponent(titleLabel.getPreferredSize().height / 2, new JBColor(Gray._220, Gray._80), null);

  JPanel panel = new JPanel(new BorderLayout());
  panel.add(titleLabel, BorderLayout.WEST);
  panel.add(separatorComponent, BorderLayout.CENTER);

  panel.setBorder(JBUI.Borders.empty(3));
  titleLabel.setBorder(JBUI.Borders.emptyRight(3));

  panel.setBackground(background);
  return panel;
}
 
Example #2
Source File: ModernWhiteEditorTabsUI.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void doPaintBackground(Graphics2D g, Rectangle clip, boolean vertical, Rectangle rectangle) {
  g.setColor(UIUtil.getPanelBackground());
  g.fill(clip);

  g.setColor(new Color(0, 0, 0, 80));
  g.fill(clip);

  final int x = rectangle.x;
  final int y = rectangle.y;
  g.setPaint(new Color(255, 255, 255, 160));
  g.fillRect(x, rectangle.y, rectangle.width, rectangle.height + (vertical ? 1 : 0));

  if (!vertical) {
    g.setColor(Gray._210);
    g.drawLine(x, rectangle.y, x + rectangle.width, rectangle.y);
  }
}
 
Example #3
Source File: PoppedIcon.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void paintBackground(Graphics g, Dimension size, int state) {
  if (UIUtil.isUnderAquaLookAndFeel()) {
    if (state == ActionButtonComponent.PUSHED) {
      ((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, ALPHA_40, size.width, size.height, ALPHA_20));
      g.fillRect(0, 0, size.width - 1, size.height - 1);

      g.setColor(ALPHA_120);
      g.drawLine(0, 0, 0, size.height - 2);
      g.drawLine(1, 0, size.width - 2, 0);

      g.setColor(ALPHA_30);
      g.drawRect(1, 1, size.width - 3, size.height - 3);
    }
    else if (state == ActionButtonComponent.POPPED) {
      ((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, Gray._235, 0, size.height, Gray._200));
      g.fillRect(1, 1, size.width - 3, size.height - 3);
    }
  }
  else {
    final Color bg = UIUtil.getPanelBackground();
    final boolean dark = UIUtil.isUnderDarcula();
    g.setColor(state == ActionButtonComponent.PUSHED ? ColorUtil.shift(bg, dark ? 1d / 0.7d : 0.7d) : dark ? Gray._255.withAlpha(40) : ALPHA_40);
    g.fillRect(JBUI.scale(1), JBUI.scale(1), size.width - JBUI.scale(2), size.height - JBUI.scale(2));
  }
}
 
Example #4
Source File: ShadowBorderPainter.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static Shadow createShadow(Image source, int x, int y, boolean paintSource, int shadowSize) {
  source = ImageUtil.toBufferedImage(source);
  final float w = source.getWidth(null);
  final float h = source.getHeight(null);
  float ratio = w / h;
  float deltaX = shadowSize;
  float deltaY = shadowSize / ratio;

  final Image scaled = source.getScaledInstance((int)(w + deltaX), (int)(h + deltaY), Image.SCALE_SMOOTH);

  final BufferedImage s = GraphicsUtilities.createCompatibleTranslucentImage(scaled.getWidth(null), scaled.getHeight(null));
  final Graphics2D graphics = (Graphics2D)s.getGraphics();
  graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  graphics.drawImage(scaled, 0, 0, null);

  final BufferedImage shadow = new ShadowRenderer(shadowSize, .25f, Gray.x00).createShadow(s);
  if (paintSource) {
    final Graphics imgG = shadow.getGraphics();
    final double d = shadowSize * 0.5;
    imgG.drawImage(source, (int)(shadowSize + d), (int)(shadowSize + d / ratio), null);
  }

  return new Shadow(shadow, x - shadowSize - 5, y - shadowSize + 2);
}
 
Example #5
Source File: ColorIcon.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void paintIcon(final Component component, final Graphics g, final int i, final int j) {
  final int iconWidth = getIconWidth();
  final int iconHeight = getIconHeight();
  g.setColor(getIconColor());

  final int size = getColorSize();
  final int x = i + (iconWidth - size) / 2;
  final int y = j + (iconHeight - size) / 2;

  g.fillRect(x, y, size, size);

  if (myBorder) {
    g.setColor(Gray.x00.withAlpha(40));
    g.drawRect(x, y, size, size);
  }
}
 
Example #6
Source File: IdeMenuBar.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public Border getBorder() {
  //avoid moving lines
  if (myState == State.EXPANDING || myState == State.COLLAPSING) {
    return new EmptyBorder(0, 0, 0, 0);
  }

  //fix for Darcula double border
  if (myState == State.TEMPORARY_EXPANDED && UIUtil.isUnderDarcula()) {
    return new CustomLineBorder(Gray._75, 0, 0, 1, 0);
  }

  //save 1px for mouse handler
  if (myState == State.COLLAPSED) {
    return new EmptyBorder(0, 0, 1, 0);
  }

  return UISettings.getInstance().SHOW_MAIN_TOOLBAR || UISettings.getInstance().SHOW_NAVIGATION_BAR ? super.getBorder() : null;
}
 
Example #7
Source File: PluginHeaderPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
public PluginHeaderPanel(@Nullable PluginManagerMain manager, JTable pluginTable) {
  myManager = manager;
  myPluginTable = pluginTable;
  final Font font = myName.getFont();
  myName.setFont(new Font(font.getFontName(), font.getStyle(), font.getSize() + 2));
  final JBColor greyed = new JBColor(Gray._130, Gray._200);
  myCategory.setForeground(greyed);
  myDownloads.setForeground(greyed);
  myUpdated.setForeground(greyed);
  myVersion.setForeground(greyed);
  final Font smallFont = new Font(font.getFontName(), font.getStyle(), font.getSize() - 1);
  myCategory.setFont(smallFont);
  myVersion.setFont(smallFont);
  myDownloads.setFont(smallFont);
  myUpdated.setFont(smallFont);
  myRoot.setVisible(false);
}
 
Example #8
Source File: DarculaEditorTabsUI.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void doPaintBackground(Graphics2D g, Rectangle clip, boolean vertical, Rectangle rectangle) {
  g.setColor(UIUtil.getPanelBackground());
  g.fill(clip);

  g.setColor(new Color(0, 0, 0, 80));
  g.fill(clip);

  final int x = rectangle.x;
  final int y = rectangle.y;
  final int h = rectangle.height;
  g.setPaint(Gray._78.withAlpha(120));
  final int w = rectangle.width;
  g.fillRect(x, rectangle.y, w, h + (vertical ? 1 : 0));

  if (!vertical) {
    g.setColor(Gray._78);
    g.drawLine(x, rectangle.y, x + w, rectangle.y);
  }
}
 
Example #9
Source File: MacEditorTabsUI.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void doPaintBackground(Graphics2D g, Rectangle clip, boolean vertical, Rectangle rectangle) {
  g.setColor(UIUtil.getPanelBackground());
  g.fill(clip);

  g.setColor(new Color(0, 0, 0, 80));
  g.fill(clip);

  final int x = rectangle.x;
  final int y = rectangle.y;
  g.setPaint(new Color(255, 255, 255, 160));
  g.fillRect(x, rectangle.y, rectangle.width, rectangle.height + (vertical ? 1 : 0));

  if (!vertical) {
    g.setColor(Gray._210);
    g.drawLine(x, rectangle.y, x + rectangle.width, rectangle.y);
  }
}
 
Example #10
Source File: ZoomingDelegate.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void paint(Graphics g) {
  if (myCachedImage != null && myMagnificationPoint != null && myMagnification != 0) {
    double scale = magnificationToScale(myMagnification);
    int xoffset = (int)(myMagnificationPoint.x - myMagnificationPoint.x * scale);
    int yoffset = (int)(myMagnificationPoint.y - myMagnificationPoint.y * scale);

    Rectangle clip = g.getClipBounds();

    g.setColor(Gray._120);
    g.fillRect(clip.x, clip.y, clip.width, clip.height);

    Graphics2D translated = (Graphics2D)g.create();
    translated.translate(xoffset, yoffset);
    translated.scale(scale, scale);

    translated.drawImage(myCachedImage, 0, 0, null);
  }
}
 
Example #11
Source File: IntelliJEditorTabsUI.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void doPaintBackground(Graphics2D g, Rectangle clip, boolean vertical, Rectangle rectangle) {
  g.setColor(UIUtil.getPanelBackground());
  g.fill(clip);

  g.setColor(new Color(0, 0, 0, 80));
  g.fill(clip);

  final int x = rectangle.x;
  final int y = rectangle.y;
  g.setPaint(UIUtil.getGradientPaint(x, y, new Color(255, 255, 255, 160), x, rectangle.y + rectangle.height, new Color(255, 255, 255, 120)));
  g.fillRect(x, rectangle.y, rectangle.width, rectangle.height + (vertical ? 1 : 0));

  if (!vertical) {
    g.setColor(Gray._210);
    g.drawLine(x, rectangle.y, x + rectangle.width, rectangle.y);
  }
}
 
Example #12
Source File: DarculaTextBorder.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void paintBorder(Component c, Graphics g2, int x, int y, int width, int height) {
  if (DarculaTextFieldUI.isSearchField(c)) return;
  Graphics2D g = ((Graphics2D)g2);
  final GraphicsConfig config = new GraphicsConfig(g);
  g.translate(x, y);

  if (c.hasFocus()) {
    DarculaUIUtil.paintFocusRing(g, new Rectangle(JBUI.scale(2), JBUI.scale(2), width - JBUI.scale(4), height - JBUI.scale(4)));
  }
  else {
    boolean editable = !(c instanceof JTextComponent) || (((JTextComponent)c).isEditable());
    g.setColor(c.isEnabled() && editable ? Gray._100 : new Color(0x535353));
    g.drawRect(JBUI.scale(1), JBUI.scale(1), width - JBUI.scale(2), height - JBUI.scale(2));
  }
  g.translate(-x, -y);
  config.restore();
}
 
Example #13
Source File: DarculaEditorTabsUI.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void doPaintBackground(Graphics2D g, Rectangle clip, boolean vertical, Rectangle rectangle) {
  g.setColor(UIUtil.getPanelBackground());
  g.fill(clip);

  g.setColor(new Color(0, 0, 0, 80));
  g.fill(clip);

  final int x = rectangle.x;
  final int y = rectangle.y;
  final int h = rectangle.height;
  g.setPaint(UIUtil.getGradientPaint(x, y, Gray._78.withAlpha(160), x, y + h, Gray._78.withAlpha(120)));
  final int w = rectangle.width;
  g.fillRect(x, rectangle.y, w, h + (vertical ? 1 : 0));

  if (!vertical) {
    g.setColor(Gray._78);
    g.drawLine(x, rectangle.y, x + w, rectangle.y);
  }
}
 
Example #14
Source File: ModernDarkEditorTabsUI.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void doPaintInactiveImpl(Graphics2D g2d,
                                Rectangle effectiveBounds,
                                int x,
                                int y,
                                int w,
                                int h,
                                Color tabColor,
                                int row,
                                int column,
                                boolean vertical) {
  if (tabColor != null) {
    g2d.setColor(tabColor);
    g2d.fillRect(x, y, w, h);
  }
  else {
    g2d.setPaint(UIUtil.getControlColor());
    g2d.fillRect(x, y, w, h);
  }

  g2d.setColor(Gray._0.withAlpha(10));
  g2d.drawRect(x, y, w - 1, h - 1);
}
 
Example #15
Source File: IntelliJEditorTabsUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void doPaintInactiveImpl(Graphics2D g2d,
                                Rectangle effectiveBounds,
                                int x,
                                int y,
                                int w,
                                int h,
                                Color tabColor,
                                int row,
                                int column,
                                boolean vertical) {
  if (tabColor != null) {
    g2d.setPaint(UIUtil.getGradientPaint(x, y, Gray._200, x, y + effectiveBounds.height, Gray._130));
    g2d.fillRect(x, y, w, h);

    g2d.setColor(ColorUtil.toAlpha(tabColor, 150));
    g2d.fillRect(x, y, w, h);
  }
  else {
    g2d.setPaint(UIUtil.getGradientPaint(x, y, Gray._255.withAlpha(180), x, y + effectiveBounds.height, Gray._255.withAlpha(100)));
    g2d.fillRect(x, y, w, h);
  }


  // Push top row under the navbar or toolbar and have a blink over previous row shadow for 2nd and subsequent rows.
  if (row == 0) {
    g2d.setColor(Gray._200.withAlpha(200));
  }
  else {
    g2d.setColor(Gray._255.withAlpha(100));
  }

  g2d.drawLine(x, y, x + w - 1, y);
}
 
Example #16
Source File: DarculaUIUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static Color getOutlineColor(boolean enabled, boolean focused) {
  return enabled
         ? focused
           ? JBColor.namedColor("Component.focusedBorderColor", JBColor.namedColor("Outline.focusedColor", 0x87AFDA))
           : JBColor.namedColor("Component.borderColor", JBColor.namedColor("Outline.color", Gray.xBF))
         : JBColor.namedColor("Component.disabledBorderColor", JBColor.namedColor("Outline.disabledColor", Gray.xCF));
}
 
Example #17
Source File: IntelliJEditorTabsUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected void doPaintAdditionalBackgroundIfFirstOffsetSet(JBTabsImpl tabs, Graphics2D g2d, Rectangle clip) {
  if (tabs.getTabsPosition() == JBTabsPosition.top && tabs.isSingleRow() && tabs.getFirstTabOffset() > 0) {
    int maxOffset = 0;
    int maxLength = 0;

    for (int i = tabs.getVisibleInfos().size() - 1; i >= 0; i--) {
      TabInfo visibleInfo = tabs.getVisibleInfos().get(i);
      TabLabel tabLabel = tabs.myInfo2Label.get(visibleInfo);
      Rectangle r = tabLabel.getBounds();
      if (r.width == 0 || r.height == 0) continue;
      maxOffset = r.x + r.width;
      maxLength = r.height;
      break;
    }

    maxOffset++;
    g2d.setPaint(UIUtil.getPanelBackground());
    if (tabs.getFirstTabOffset() > 0) {
      g2d.fillRect(clip.x, clip.y, clip.x + JBUI.scale(tabs.getFirstTabOffset() - 1), clip.y + maxLength - tabs.getActiveTabUnderlineHeight());
    }
    g2d.fillRect(clip.x + maxOffset, clip.y, clip.width - maxOffset, clip.y + maxLength - tabs.getActiveTabUnderlineHeight());
    g2d.setPaint(new JBColor(Gray._181, UIUtil.getPanelBackground()));
    g2d.drawLine(clip.x + maxOffset, clip.y + maxLength - tabs.getActiveTabUnderlineHeight(), clip.x + clip.width,
                 clip.y + maxLength - tabs.getActiveTabUnderlineHeight());
    g2d.setPaint(UIUtil.getPanelBackground());
    g2d.drawLine(clip.x, clip.y + maxLength, clip.width, clip.y + maxLength);
  }
}
 
Example #18
Source File: DarculaTableHeaderUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void paint(Graphics g2, JComponent c) {
  final Graphics2D g = (Graphics2D)g2;
  final GraphicsConfig config = new GraphicsConfig(g);
  final Color bg = c.getBackground();
  g.setPaint(UIUtil.getGradientPaint(0, 0, ColorUtil.shift(bg, 1.4), 0, c.getHeight(), ColorUtil.shift(bg, 0.9)));
  final int h = c.getHeight();
  final int w = c.getWidth();
  g.fillRect(0,0, w, h);
  g.setPaint(ColorUtil.shift(bg, 0.75));
  g.drawLine(0, h-1, w, h-1);
  g.drawLine(w-1, 0, w-1, h-1);

  final Enumeration<TableColumn> columns = ((JTableHeader)c).getColumnModel().getColumns();

  final Color lineColor = ColorUtil.shift(bg, 0.7);
  final Color shadow = Gray._255.withAlpha(30);
  int offset = 0;
  while (columns.hasMoreElements()) {
    final TableColumn column = columns.nextElement();
    if (columns.hasMoreElements() && column.getWidth() > 0) {
      offset += column.getWidth();
      g.setColor(lineColor);
      g.drawLine(offset-1, 1, offset-1, h-3);
      g.setColor(shadow);
      g.drawLine(offset, 1, offset, h-3);
    }
  }

  config.restore();

  super.paint(g, c);
}
 
Example #19
Source File: MacEditorTabsUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void doPaintInactiveImpl(Graphics2D g2d,
                                Rectangle effectiveBounds,
                                int x,
                                int y,
                                int w,
                                int h,
                                Color tabColor,
                                int row,
                                int column,
                                boolean vertical) {
  g2d.setColor(Gray._255);
  g2d.fillRect(x, y, w, h);

  if (tabColor != null) {
    g2d.setColor(ColorUtil.toAlpha(tabColor, 200));
    g2d.fillRect(x, y, w, h);
  }

  g2d.setColor(Gray._150.withAlpha(100));
  g2d.fillRect(x, y, w, h);

  // Push top row under the navbar or toolbar and have a blink over previous row shadow for 2nd and subsequent rows.
  if (row == 0) {
    g2d.setColor(Gray._200.withAlpha(200));
  }
  else {
    g2d.setColor(Gray._255.withAlpha(100));
  }

  g2d.drawLine(x, y, x + w - 1, y);
}
 
Example #20
Source File: DarculaPopupMenuBorder.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  Graphics2D g2 = (Graphics2D)g.create();
  try {
    g2.setColor(JBColor.namedColor("Menu.borderColor", new JBColor(Gray.xCD, Gray.x51)));
    g2.fill(getBorderShape(c, new Rectangle(x, y, width, height)));
  }
  finally {
    g2.dispose();
  }
}
 
Example #21
Source File: MacUIUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void drawToolbarDecoratorBackground(Graphics g2, int width, int height) {
  final Graphics2D g = (Graphics2D)g2;
  final int h1 = height / 2;
  g.setPaint(UIUtil.getGradientPaint(0, 0, Gray._247, 0, h1, Gray._240));
  g.fillRect(0, 0, width, h1);
  g.setPaint(UIUtil.getGradientPaint(0, h1, Gray._229, 0, height, Gray._234));
  g.fillRect(0, h1, width, height);
}
 
Example #22
Source File: DarculaEditorTabsUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void doPaintInactiveImpl(Graphics2D g2d, Rectangle effectiveBounds, int x, int y, int w, int h, Color tabColor, int row, int column, boolean vertical) {
  if (tabColor != null) {
    g2d.setColor(tabColor);
    g2d.fillRect(x, y, w, h);
  }
  else {
    g2d.setPaint(UIUtil.getControlColor());
    g2d.fillRect(x, y, w, h);
  }

  g2d.setColor(Gray._0.withAlpha(10));
  g2d.drawRect(x, y, w - 1, h - 1);
}
 
Example #23
Source File: DarculaSpinnerBorder.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  final JSpinner spinner = (JSpinner)c;
  final JFormattedTextField editor = UIUtil.findComponentOfType(spinner, JFormattedTextField.class);
  final int x1 = x + JBUI.scale(3);
  final int y1 = y + JBUI.scale(3);
  final int width1 = width - JBUI.scale(8);
  final int height1 = height - JBUI.scale(6);
  final boolean focused = c.isEnabled() && c.isVisible() && editor != null && editor.hasFocus();
  final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);

  if (c.isOpaque()) {
    g.setColor(UIUtil.getPanelBackground());
    g.fillRect(x, y, width, height);
  }

  g.setColor(UIUtil.getTextFieldBackground());
  g.fillRoundRect(x1, y1, width1, height1, JBUI.scale(5), JBUI.scale(5));
  g.setColor(UIUtil.getPanelBackground());
  if (editor != null) {
    final int off = editor.getBounds().x + editor.getWidth() + ((JSpinner)c).getInsets().left + JBUI.scale(1);
    g.fillRect(off, y1, JBUI.scale(17), height1);
    g.setColor(Gray._100);
    g.drawLine(off, y1, off, height1 + JBUI.scale(2));
  }

  if (!c.isEnabled()) {
    ((Graphics2D)g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f));
  }

  if (focused) {
    DarculaUIUtil.paintFocusRing(g, new Rectangle(x1, y1, width1, height1));
  }
  else {
    g.setColor(Gray._100);
    g.drawRoundRect(x1, y1, width1, height1, JBUI.scale(5), JBUI.scale(5));
  }
  config.restore();
}
 
Example #24
Source File: RequestRunnable.java    From GoogleTranslation with Apache License 2.0 5 votes vote down vote up
private void showPopupBalloon(final String result) {
    ApplicationManager.getApplication().invokeLater(() -> {
        mEditor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION, null);//解决因为TranslationPlugin而导致的泡泡显示错位问题
        JBPopupFactory factory = JBPopupFactory.getInstance();
        factory.createHtmlTextBalloonBuilder(result, null, new JBColor(Gray._242, Gray._0), null)
                .createBalloon()
                .show(factory.guessBestPopupLocation(mEditor), Balloon.Position.below);
    });
}
 
Example #25
Source File: SheetController.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void initShadowImage() {

    final BufferedImage mySheetStencil = GraphicsUtilities.createCompatibleTranslucentImage(SHEET_WIDTH, SHEET_HEIGHT);

    Graphics2D g2 = mySheetStencil.createGraphics();
    g2.setColor(new JBColor(Gray._255, Gray._0));
    g2.fillRect(0, 0, SHEET_WIDTH, SHEET_HEIGHT);
    g2.dispose();

    ShadowRenderer renderer = new ShadowRenderer();
    renderer.setSize(SHADOW_BORDER);
    renderer.setOpacity(.80f);
    renderer.setColor(new JBColor(JBColor.BLACK, Gray._10));
    myShadowImage = renderer.createShadow(mySheetStencil);
  }
 
Example #26
Source File: DesktopInternalDecorator.java    From consulo with Apache License 2.0 5 votes vote down vote up
@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(SystemInfo.isMac && UIUtil.isUnderIntelliJLaF() ? Gray.xC9 : Gray._155);
    doPaintBorder(c, g, x, y, width, height);
  }
}
 
Example #27
Source File: ModernWhiteEditorTabsUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void doPaintInactiveImpl(Graphics2D g2d,
                                Rectangle effectiveBounds,
                                int x,
                                int y,
                                int w,
                                int h,
                                Color tabColor,
                                int row,
                                int column,
                                boolean vertical) {
  g2d.setColor(Gray._255);
  g2d.fillRect(x, y, w, h);

  if (tabColor != null) {
    g2d.setColor(ColorUtil.toAlpha(tabColor, 200));
    g2d.fillRect(x, y, w, h);
  }

  g2d.setColor(Gray._150.withAlpha(100));
  g2d.fillRect(x, y, w, h);

  // Push top row under the navbar or toolbar and have a blink over previous row shadow for 2nd and subsequent rows.
  if (row == 0) {
    g2d.setColor(Gray._200.withAlpha(200));
  }
  else {
    g2d.setColor(Gray._255.withAlpha(100));
  }

  g2d.drawLine(x, y, x + w - 1, y);
}
 
Example #28
Source File: ContentTabLabel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected Color getPassiveFg(boolean selected) {
  if (contentManager().getContentCount() > 1) {
    return selected && !UIUtil.isUnderDarcula() ? Gray._255 : UIUtil.isUnderDarcula() ? UIUtil.getLabelDisabledForeground() : Gray._75;
  }

  return super.getPassiveFg(selected);
}
 
Example #29
Source File: MacIntelliJTextFieldUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void paintAquaSearchFocusRing(Graphics2D g, Rectangle r, Component c) {
  Graphics2D g2 = (Graphics2D)g.create();
  try {
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, MacUIUtil.USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE);
    g2.translate(r.x, r.y);

    int arc = JBUI.scale(6);
    double lw = UIUtil.isRetina(g2) ? 0.5 : 1.0;
    Shape outerShape = new RoundRectangle2D.Double(JBUI.scale(3), JBUI.scale(3),
                                                   r.width - JBUI.scale(6),
                                                   r.height - JBUI.scale(6),
                                                   arc, arc);
    g2.setColor(c.getBackground());
    g2.fill(outerShape);

    Path2D path = new Path2D.Double(Path2D.WIND_EVEN_ODD);
    path.append(outerShape, false);
    path.append(new RoundRectangle2D.Double(JBUI.scale(3) + lw, JBUI.scale(3) + lw,
                                            r.width - JBUI.scale(6) - lw*2,
                                            r.height - JBUI.scale(6) - lw*2,
                                            arc-lw, arc-lw), false);

    g2.setColor(Gray.xBC);
    g2.fill(path);

    if (c.hasFocus()) {
      DarculaUIUtilPart.paintFocusBorder(g2, r.width, r.height, arc, true);
    }
  }
  finally {
    g2.dispose();
  }
}
 
Example #30
Source File: DesktopStripePanelImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  Insets insets = ((JComponent)c).getInsets();

  if (UIUtil.isUnderDarcula()) {
    g.setColor(Gray._40);
    drawBorder(g, x, y, width, height, insets);
  }
  else {
    g.setColor(UIUtil.getPanelBackground());
    drawBorder(g, x, y, width, height, insets);
    g.setColor(Gray._155);
    drawBorder(g, x, y, width, height, insets);
  }
}