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();
}
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);
});
}
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;
}
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));
}
}
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;
}
Aggregations