Search in sources :

Example 41 with JBColor

use of com.intellij.ui.JBColor in project intellij-community by JetBrains.

the class DarculaProgressBarUI method paintIndeterminate.

@Override
protected void paintIndeterminate(Graphics g2d, JComponent c) {
    if (!(g2d instanceof Graphics2D)) {
        return;
    }
    Graphics2D g = (Graphics2D) g2d;
    // area for border
    Insets b = progressBar.getInsets();
    int barRectWidth = progressBar.getWidth() - (b.right + b.left);
    int barRectHeight = progressBar.getHeight() - (b.top + b.bottom);
    if (barRectWidth <= 0 || barRectHeight <= 0) {
        return;
    }
    //boxRect = getBox(boxRect);
    g.setColor(new JBColor(Gray._240, Gray._128));
    int w = c.getWidth();
    int h = c.getPreferredSize().height;
    if (!isEven(c.getHeight() - h))
        h++;
    if (c.isOpaque()) {
        g.fillRect(0, (c.getHeight() - h) / 2, w, h);
    }
    g.setColor(new JBColor(Gray._165, Gray._88));
    final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
    g.translate(0, (c.getHeight() - h) / 2);
    int x = -offset;
    final float R = JBUI.scale(8f);
    final float R2 = JBUI.scale(9f);
    final float off = JBUI.scale(1f);
    final Area innerBorderRoundRect = new Area(new RoundRectangle2D.Float(off, off, w - 2f * off, h - 2f * off, R, R));
    final Area containingRoundRect = new Area(new RoundRectangle2D.Float(2f * off, 2f * off, w - 4f * off, h - 4f * off, R, R));
    while (x < Math.max(c.getWidth(), c.getHeight())) {
        Path2D.Double path = new Path2D.Double();
        float ww = getPeriodLength() / 2f;
        path.moveTo(x, 0);
        path.lineTo(x + ww, 0);
        path.lineTo(x + ww - h / 2, h);
        path.lineTo(x - h / 2, h);
        path.lineTo(x, 0);
        path.closePath();
        final Area area = new Area(path);
        area.intersect(containingRoundRect);
        g.fill(area);
        x += getPeriodLength();
    }
    offset = (offset + 1) % getPeriodLength();
    Area area = new Area(new Rectangle2D.Float(0, 0, w, h));
    area.subtract(innerBorderRoundRect);
    g.setColor(Gray._128);
    if (c.isOpaque()) {
        g.fill(area);
    }
    area.subtract(new Area(new RoundRectangle2D.Float(0, 0, w, h, R2, R2)));
    g.setColor(c.getParent().getBackground());
    if (c.isOpaque()) {
        g.fill(area);
    }
    Area insetArea = new Area(innerBorderRoundRect);
    insetArea.subtract(containingRoundRect);
    g.fill(insetArea);
    g.translate(0, -(c.getHeight() - h) / 2);
    // Deal with possible text painting
    if (progressBar.isStringPainted()) {
        if (progressBar.getOrientation() == SwingConstants.HORIZONTAL) {
            paintString(g, b.left, b.top, barRectWidth, barRectHeight, boxRect.x, boxRect.width);
        } else {
            paintString(g, b.left, b.top, barRectWidth, barRectHeight, boxRect.y, boxRect.height);
        }
    }
    config.restore();
}
Also used : GraphicsConfig(com.intellij.openapi.ui.GraphicsConfig) JBColor(com.intellij.ui.JBColor)

Example 42 with JBColor

use of com.intellij.ui.JBColor in project intellij-community by JetBrains.

the class EditorEmptyTextPainter method paintEmptyText.

public void paintEmptyText(@NotNull final JComponent splitters, @NotNull Graphics g) {
    UISettings.setupAntialiasing(g);
    g.setColor(new JBColor(Gray._80, Gray._160));
    g.setFont(JBUI.Fonts.label(16f));
    UIUtil.TextPainter painter = new UIUtil.TextPainter().withLineSpacing(1.8f);
    advertiseActions(splitters, painter);
    painter.draw(g, (width, height) -> {
        Dimension s = splitters.getSize();
        int w = (s.width - width) / 2;
        int h = (int) (s.height * heightRatio());
        return Couple.of(w, h);
    });
}
Also used : JBColor(com.intellij.ui.JBColor) UIUtil(com.intellij.util.ui.UIUtil)

Example 43 with JBColor

use of com.intellij.ui.JBColor in project intellij-community by JetBrains.

the class ImmediatePainter method getCaretColor.

private static Color getCaretColor(final Editor editor) {
    Color overriddenColor = editor.getCaretModel().getPrimaryCaret().getVisualAttributes().getColor();
    if (overriddenColor != null)
        return overriddenColor;
    final Color caretColor = editor.getColorsScheme().getColor(EditorColors.CARET_COLOR);
    return caretColor == null ? new JBColor(Gray._0, Gray._255) : caretColor;
}
Also used : JBColor(com.intellij.ui.JBColor) JBColor(com.intellij.ui.JBColor)

Example 44 with JBColor

use of com.intellij.ui.JBColor in project intellij-community by JetBrains.

the class DefaultColorGenerator method calcColor.

@NotNull
private static JBColor calcColor(int indexColor) {
    int r = indexColor * 200 + 30;
    int g = indexColor * 130 + 50;
    int b = indexColor * 90 + 100;
    try {
        Color color = new Color(rangeFix(r), rangeFix(g), rangeFix(b));
        return new JBColor(color, color);
    } catch (IllegalArgumentException a) {
        throw new IllegalArgumentException("indexColor: " + indexColor + " " + r % 256 + " " + (g % 256) + " " + (b % 256));
    }
}
Also used : JBColor(com.intellij.ui.JBColor) JBColor(com.intellij.ui.JBColor) NotNull(org.jetbrains.annotations.NotNull)

Example 45 with JBColor

use of com.intellij.ui.JBColor in project intellij-community by JetBrains.

the class DesignerEditorPanel method createScrollPane.

protected JScrollPane createScrollPane(@NotNull JLayeredPane content) {
    JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(content);
    scrollPane.setBackground(new JBColor(Color.WHITE, UIUtil.getListBackground()));
    return scrollPane;
}
Also used : JBColor(com.intellij.ui.JBColor)

Aggregations

JBColor (com.intellij.ui.JBColor)51 GraphicsConfig (com.intellij.openapi.ui.GraphicsConfig)8 NotNull (org.jetbrains.annotations.NotNull)8 SimpleTextAttributes (com.intellij.ui.SimpleTextAttributes)4 Rectangle2D (java.awt.geom.Rectangle2D)4 UIUtil (com.intellij.util.ui.UIUtil)3 Project (com.intellij.openapi.project.Project)2 BalloonLayout (com.intellij.ui.BalloonLayout)2 BalloonLayoutData (com.intellij.ui.BalloonLayoutData)2 StudyStatus (com.jetbrains.edu.learning.courseFormat.StudyStatus)2 RoundRectangle2D (java.awt.geom.RoundRectangle2D)2 BasicArrowButton (javax.swing.plaf.basic.BasicArrowButton)2 Nullable (org.jetbrains.annotations.Nullable)2 ItemResourceValue (com.android.ide.common.rendering.api.ItemResourceValue)1 ResourceValue (com.android.ide.common.rendering.api.ResourceValue)1 LegendComponent (com.android.tools.adtui.LegendComponent)1 LegendRenderData (com.android.tools.adtui.LegendRenderData)1 TimelineComponent (com.android.tools.adtui.TimelineComponent)1 ConfiguredThemeEditorStyle (com.android.tools.idea.editors.theme.datamodels.ConfiguredThemeEditorStyle)1 MergedManifest (com.android.tools.idea.model.MergedManifest)1