Search in sources :

Example 26 with GraphicsContext

use of com.github.weisj.darklaf.util.graphics.GraphicsContext in project darklaf by weisJ.

the class PaintUtil method paintFocusBorder.

public static void paintFocusBorder(final Graphics2D g, final int width, final int height, final float arc, final float bw, final boolean active) {
    GraphicsContext config = new GraphicsContext(g);
    g.setComposite(PaintUtil.glowComposite);
    paintOutlineBorder(g, width, height, arc, bw, active, Outline.focus);
    config.restore();
}
Also used : GraphicsContext(com.github.weisj.darklaf.util.graphics.GraphicsContext)

Example 27 with GraphicsContext

use of com.github.weisj.darklaf.util.graphics.GraphicsContext in project darklaf by weisJ.

the class PaintUtil method paintFocusOval.

public static void paintFocusOval(final Graphics2D g, final float x, final float y, final float width, final float height, final boolean active, final float bw) {
    GraphicsContext config = new GraphicsContext(g);
    g.setComposite(PaintUtil.glowComposite);
    Outline.focus.setGraphicsColor(g, active);
    Path2D shape = new Path2D.Float(Path2D.WIND_EVEN_ODD);
    shape.append(new Ellipse2D.Float(x - bw, y - bw, width + bw * 2, height + bw * 2), false);
    shape.append(new Ellipse2D.Float(x, y, width, height), false);
    g.fill(shape);
    config.restore();
}
Also used : GraphicsContext(com.github.weisj.darklaf.util.graphics.GraphicsContext) Path2D(java.awt.geom.Path2D) Ellipse2D(java.awt.geom.Ellipse2D)

Example 28 with GraphicsContext

use of com.github.weisj.darklaf.util.graphics.GraphicsContext in project darklaf by weisJ.

the class PaintUtil method fillFocusRect.

public static void fillFocusRect(final Graphics2D g, final int x, final int y, final int width, final int height, final boolean active) {
    GraphicsContext config = new GraphicsContext(g);
    g.setComposite(PaintUtil.glowComposite);
    Outline.focus.setGraphicsColor(g, active);
    g.fillRect(x, y, width, height);
    config.restore();
}
Also used : GraphicsContext(com.github.weisj.darklaf.util.graphics.GraphicsContext)

Example 29 with GraphicsContext

use of com.github.weisj.darklaf.util.graphics.GraphicsContext in project darklaf by weisJ.

the class PaintUtil method fillRoundRect.

public static void fillRoundRect(final Graphics2D g, final float x, final float y, final float width, final float height, final int arc, final boolean adjustForBorder) {
    GraphicsContext context = GraphicsUtil.setupStrokePainting(g);
    int stroke = adjustForBorder ? (int) getStrokeWidth(g) : 0;
    float lw = Scale.equalWithError(Scale.getScaleX(g), 1f) ? stroke : stroke / 2f;
    float arcSize = arc;
    arcSize -= stroke;
    g.translate(lw, lw);
    roundRect.setRoundRect(x, y, width - 2 * lw, height - 2 * lw, arcSize, arcSize);
    g.fill(roundRect);
    g.translate(-lw, -lw);
    context.restore();
}
Also used : GraphicsContext(com.github.weisj.darklaf.util.graphics.GraphicsContext)

Example 30 with GraphicsContext

use of com.github.weisj.darklaf.util.graphics.GraphicsContext in project darklaf by weisJ.

the class DarkTabbedPaneUI method paintDrop.

protected void paintDrop(final Graphics g) {
    g.setColor(getDropColor());
    GraphicsContext context = new GraphicsContext(g);
    if (!scrollableTabLayoutEnabled()) {
        ((Graphics2D) g).setComposite(PaintUtil.getDropComposite());
    }
    switch(tabPane.getTabPlacement()) {
        case TOP:
            g.fillRect(dropRect.x, dropRect.y, dropRect.width, dropRect.height - 1);
            break;
        case BOTTOM:
            g.fillRect(dropRect.x, dropRect.y + 1, dropRect.width, dropRect.height - 1);
            break;
        case LEFT:
            g.fillRect(dropRect.x, dropRect.y, dropRect.width - 1, dropRect.height);
            break;
        case RIGHT:
            g.fillRect(dropRect.x + 1, dropRect.y, dropRect.width - 1, dropRect.height);
            break;
    }
    context.restore();
}
Also used : GraphicsContext(com.github.weisj.darklaf.util.graphics.GraphicsContext)

Aggregations

GraphicsContext (com.github.weisj.darklaf.util.graphics.GraphicsContext)35 Path2D (java.awt.geom.Path2D)2 RoundRectangle2D (java.awt.geom.RoundRectangle2D)2 MenuItemLayoutHelper (com.github.weisj.darklaf.compatibility.MenuItemLayoutHelper)1 DarkTableScrollPaneBorder (com.github.weisj.darklaf.ui.table.DarkTableScrollPaneBorder)1 AlignmentExt (com.github.weisj.darklaf.util.AlignmentExt)1 CleanupTask (com.github.weisj.darklaf.util.value.CleanupTask)1 Color (java.awt.Color)1 Rectangle (java.awt.Rectangle)1 AffineTransform (java.awt.geom.AffineTransform)1 Area (java.awt.geom.Area)1 Ellipse2D (java.awt.geom.Ellipse2D)1 Rectangle2D (java.awt.geom.Rectangle2D)1 BufferedImage (java.awt.image.BufferedImage)1 JMenuItem (javax.swing.JMenuItem)1 TableColumn (javax.swing.table.TableColumn)1 TableColumnModel (javax.swing.table.TableColumnModel)1 JTextComponent (javax.swing.text.JTextComponent)1 View (javax.swing.text.View)1