Search in sources :

Example 6 with JBColor

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

the class LessonDirectoryNode method updateImpl.

@Override
protected void updateImpl(PresentationData data) {
    StudyStatus status = myLesson.getStatus();
    boolean isSolved = status != StudyStatus.Solved;
    JBColor color = isSolved ? JBColor.BLACK : LIGHT_GREEN;
    Icon icon = isSolved ? InteractiveLearningIcons.Lesson : InteractiveLearningIcons.LessonCompl;
    updatePresentation(data, myLesson.getName(), color, icon, null);
}
Also used : StudyStatus(com.jetbrains.edu.learning.courseFormat.StudyStatus) JBColor(com.intellij.ui.JBColor)

Example 7 with JBColor

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

the class TaskDirectoryNode method updateImpl.

@Override
protected void updateImpl(PresentationData data) {
    StudyStatus status = myTask.getStatus();
    String subtaskInfo = myTask.hasSubtasks() ? getSubtaskInfo() : null;
    if (status == StudyStatus.Unchecked) {
        updatePresentation(data, myTask.getName(), JBColor.BLACK, InteractiveLearningIcons.Task, subtaskInfo);
        return;
    }
    boolean isSolved = status == StudyStatus.Solved;
    JBColor color = isSolved ? LIGHT_GREEN : JBColor.RED;
    Icon icon = isSolved ? InteractiveLearningIcons.TaskCompl : InteractiveLearningIcons.TaskProbl;
    updatePresentation(data, myTask.getName(), color, icon, subtaskInfo);
}
Also used : StudyStatus(com.jetbrains.edu.learning.courseFormat.StudyStatus) JBColor(com.intellij.ui.JBColor)

Example 8 with JBColor

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

the class StudyProgressBar method paintComponent.

protected void paintComponent(Graphics g) {
    final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
    Graphics2D g2 = (Graphics2D) g;
    if (myFraction > 1) {
        myFraction = 1;
    }
    Dimension size = getSize();
    double width = size.getWidth() - 2 * myIndent;
    g2.setPaint(UIUtil.getTextFieldBackground());
    Rectangle2D rect = new Rectangle2D.Double(myIndent, 0, width, myHeight);
    g2.fill(rect);
    g2.setPaint(new JBColor(SHADOW1, JBColor.border()));
    rect.setRect(myIndent, 0, width, myHeight);
    int arcWidth = 5;
    int arcHeight = 5;
    g2.drawRoundRect(myIndent, 0, (int) width, myHeight, arcWidth, arcHeight);
    g2.setPaint(SHADOW2);
    int y_center = myHeight / 2;
    int y_steps = myHeight / 2 - 3;
    int alpha_step = y_steps > 0 ? (255 - 70) / y_steps : 255 - 70;
    int x_offset = 4;
    g.setClip(4 + myIndent, 3, (int) width - 6, myHeight - 4);
    int bricksToDraw = myFraction == 0 ? 0 : getBricksToDraw(myFraction);
    for (int i = 0; i < bricksToDraw; i++) {
        g2.setPaint(myColor);
        UIUtil.drawLine(g2, x_offset, y_center, x_offset + BRICK_WIDTH - 1, y_center);
        for (int j = 0; j < y_steps; j++) {
            Color color = ColorUtil.toAlpha(myColor, 255 - alpha_step * (j + 1));
            g2.setPaint(color);
            UIUtil.drawLine(g2, x_offset, y_center - 1 - j, x_offset + BRICK_WIDTH - 1, y_center - 1 - j);
            if (!(y_center % 2 != 0 && j == y_steps - 1)) {
                UIUtil.drawLine(g2, x_offset, y_center + 1 + j, x_offset + BRICK_WIDTH - 1, y_center + 1 + j);
            }
        }
        g2.setColor(ColorUtil.toAlpha(myColor, 255 - alpha_step * (y_steps / 2 + 1)));
        g2.drawRect(x_offset, y_center - y_steps, BRICK_WIDTH - 1, myHeight - 7);
        x_offset += BRICK_WIDTH + BRICK_SPACE;
    }
    config.restore();
}
Also used : JBColor(com.intellij.ui.JBColor) Rectangle2D(java.awt.geom.Rectangle2D) JBColor(com.intellij.ui.JBColor) GraphicsConfig(com.intellij.openapi.ui.GraphicsConfig)

Example 9 with JBColor

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

the class VariantsCompletionAction method actionPerformed.

@Override
public void actionPerformed(final AnActionEvent e) {
    final Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
    if (editor == null)
        return;
    final String prefix = myTextField.getText().substring(0, myTextField.getCaretPosition());
    if (StringUtil.isEmpty(prefix))
        return;
    final String[] array = calcWords(prefix, editor);
    if (array.length == 0) {
        return;
    }
    FeatureUsageTracker.getInstance().triggerFeatureUsed("find.completion");
    final JList list = new JBList(array) {

        @Override
        protected void paintComponent(final Graphics g) {
            GraphicsUtil.setupAntialiasing(g);
            super.paintComponent(g);
        }
    };
    list.setBackground(new JBColor(new Color(235, 244, 254), new Color(0x4C4F51)));
    list.setFont(editor.getColorsScheme().getFont(EditorFontType.PLAIN));
    Utils.showCompletionPopup(e.getInputEvent() instanceof MouseEvent ? myTextField : null, list, null, myTextField, null);
}
Also used : MouseEvent(java.awt.event.MouseEvent) JBColor(com.intellij.ui.JBColor) JBList(com.intellij.ui.components.JBList) JBColor(com.intellij.ui.JBColor) Editor(com.intellij.openapi.editor.Editor)

Example 10 with JBColor

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

the class Bookmark method createHighlighter.

public RangeHighlighter createHighlighter(@NotNull MarkupModelEx markup) {
    final RangeHighlighterEx highlighter;
    int line = getLine();
    if (line >= 0) {
        highlighter = markup.addPersistentLineHighlighter(line, HighlighterLayer.ERROR + 1, null);
        if (highlighter != null) {
            highlighter.setGutterIconRenderer(new MyGutterIconRenderer(this));
            TextAttributes textAttributes = ObjectUtils.notNull(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.BOOKMARKS_ATTRIBUTES), new TextAttributes());
            Color stripeColor = ObjectUtils.notNull(textAttributes.getErrorStripeColor(), new JBColor(0x000000, 0xdbdbdb));
            highlighter.setErrorStripeMarkColor(stripeColor);
            highlighter.setErrorStripeTooltip(getBookmarkTooltip());
            TextAttributes attributes = highlighter.getTextAttributes();
            if (attributes == null) {
                attributes = new TextAttributes();
            }
            attributes.setBackgroundColor(textAttributes.getBackgroundColor());
            attributes.setForegroundColor(textAttributes.getForegroundColor());
            highlighter.setTextAttributes(attributes);
        }
    } else {
        highlighter = null;
    }
    myHighlighterRef = highlighter == null ? null : new WeakReference<>(highlighter);
    return highlighter;
}
Also used : RangeHighlighterEx(com.intellij.openapi.editor.ex.RangeHighlighterEx) JBColor(com.intellij.ui.JBColor) WeakReference(java.lang.ref.WeakReference) TextAttributes(com.intellij.openapi.editor.markup.TextAttributes) 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