use of com.github.weisj.darklaf.util.graphics.GraphicsContext in project darklaf by weisJ.
the class HoveringPanel method paintComponent.
@Override
protected void paintComponent(final Graphics g) {
super.paintComponent(g);
GraphicsContext context = new GraphicsContext(g);
((Graphics2D) g).setComposite(PaintUtil.getTransparentComposite());
g.setColor(color != null ? color : getBackground());
PaintUtil.fillRoundRect((Graphics2D) g, 0, 0, getWidth(), getHeight(), arc, false);
context.restore();
}
use of com.github.weisj.darklaf.util.graphics.GraphicsContext in project darklaf by weisJ.
the class BubbleBorder method paintBorder.
public void paintBorder(final Graphics g, final Area strokeArea) {
final Graphics2D g2 = (Graphics2D) g;
GraphicsContext config = GraphicsUtil.setupStrokePainting(g);
g2.setColor(color);
g2.fill(strokeArea);
config.restore();
}
use of com.github.weisj.darklaf.util.graphics.GraphicsContext in project darklaf by weisJ.
the class DarkButtonBorder method paintBorder.
@Override
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) {
if (ButtonConstants.isBorderlessVariant(c)) {
paintBorderlessBorder(c, g, x, y, width, height);
return;
}
Graphics2D g2 = (Graphics2D) g;
g2.translate(x, y);
int arc = getArc(c);
int focusArc = getFocusArc(c);
GraphicsContext config = new GraphicsContext(g);
AlignmentExt corner = getCornerFlag(c);
boolean paintShadow = showDropShadow(corner);
boolean focus = paintFocus(c);
int shadowHeight = paintShadow ? getShadowSize() : 0;
int borderSize = getBorderSize();
Insets insetMask = new Insets(borderSize, borderSize, Math.max(borderSize, shadowHeight), borderSize);
Insets focusIns = new Insets(0, 0, 0, 0);
if (corner != null) {
focusIns = corner.maskInsets(focusIns, -borderSize - focusArc);
insetMask = corner.maskInsets(insetMask, -arc);
}
int bx = insetMask.left;
int by = insetMask.top;
int bw = width - insetMask.left - insetMask.right;
int bh = height - insetMask.top - insetMask.bottom;
int fx = focusIns.left;
int fy = focusIns.top;
int fw = width - focusIns.left - focusIns.right;
int fh = by + bh + borderSize - focusIns.top - focusIns.bottom;
if (paintFocus(c)) {
paintFocusBorder(g2, focusArc, borderSize, fx, fy, fw, fh);
}
paintLineBorder(c, g2, arc, focus, bx, by, bw, bh);
if (corner != null) {
paintNeighbourFocus(g2, c, width, height);
}
config.restore();
}
use of com.github.weisj.darklaf.util.graphics.GraphicsContext in project darklaf by weisJ.
the class DarkButtonUI method paint.
@Override
public void paint(final Graphics g, final JComponent c) {
validateLayout();
GraphicsContext config = new GraphicsContext(g);
AbstractButton b = (AbstractButton) c;
try (CleanupTask clean = prepareDelegate(b)) {
paintButtonBackground(g, c);
paintIcon(g, b, c);
config.restoreClip();
paintText(g, b, displayText);
}
}
use of com.github.weisj.darklaf.util.graphics.GraphicsContext in project darklaf by weisJ.
the class DarkTextFieldUI method paintSafely.
@Override
protected void paintSafely(final Graphics g) {
GraphicsContext context = new GraphicsContext(g);
super.paintSafely(g);
context.restore();
context.setupStrokePainting();
paintIcons(g);
}
Aggregations