private Paint calculateFillPaint(Object component, int width, int height) { //set the fillPaint Paint p = getBackgroundPaint(getFillPaint(), component); if(isPaintStretched()) { p = calculateSnappedPaint(p, width, height); } return p; }
/** * Sets the shape to fillPaint. This shape is not resized when the component * bounds are. To do that, create a custom shape that is bound to the * component width/height * * * @param s the Shape to fillPaint. May be null */ public void setShape(Shape s) { Shape old = getShape(); this.shape = s; setDirty(true); firePropertyChange("shape", old, getShape()); }
private Paint calculateStrokePaint(Object component, int width, int height) { Paint p = getBorderPaint(); if (p == null) { if(component instanceof JComponent) { p = ((JComponent)component).getForeground(); } } if(isPaintStretched()) { p = calculateSnappedPaint(p, width, height); } return p; }
g.setStroke(new BasicStroke(this.getBorderWidth())); if(getShape() != null) { Shape s = provideShape(g,component, w, h); Rectangle bounds = s.getBounds(); Rectangle rect = calculateLayout(bounds.width, bounds.height, w, h); g.translate(rect.x, rect.y); drawPathEffects(g, s, rect.width, rect.height); switch (getStyle()) { case BOTH: drawShape(g, s, component, rect.width, rect.height); fillShape(g, s, component, rect.width, rect.height); break; case FILLED: fillShape(g, s, component, rect.width, rect.height); break; case OUTLINE: drawShape(g, s, component, rect.width, rect.height); break;
private void drawPathEffects(Graphics2D g, Shape s, int w, int h) { if(getAreaEffects() != null) { //Paint pt = calculateFillPaint(component, w, h); for(AreaEffect ef : getAreaEffects()) { ef.apply(g, s, w, h); } } } }
private void fillShape(Graphics2D g, Shape s, Object component, int w, int h) { g.setPaint(calculateFillPaint(component, w, h)); g.fill(s); }
private void drawShape(Graphics2D g, Shape s, Object component, int w, int h) { g.setPaint(calculateStrokePaint(component, w, h)); g.draw(s); }
g.setStroke(new BasicStroke(this.getBorderWidth())); if(getShape() != null) { Shape s = provideShape(g,component, w, h); Rectangle bounds = s.getBounds(); Rectangle rect = calculateLayout(bounds.width, bounds.height, w, h); g.translate(rect.x, rect.y); drawPathEffects(g, s, rect.width, rect.height); switch (getStyle()) { case BOTH: drawShape(g, s, component, rect.width, rect.height); fillShape(g, s, component, rect.width, rect.height); break; case FILLED: fillShape(g, s, component, rect.width, rect.height); break; case OUTLINE: drawShape(g, s, component, rect.width, rect.height); break;
private void drawPathEffects(Graphics2D g, Shape s, int w, int h) { if(getAreaEffects() != null) { //Paint pt = calculateFillPaint(component, w, h); for(AreaEffect ef : getAreaEffects()) { ef.apply(g, s, w, h); } } } }
private void fillShape(Graphics2D g, Shape s, Object component, int w, int h) { g.setPaint(calculateFillPaint(component, w, h)); g.fill(s); }
private void drawShape(Graphics2D g, Shape shape, Object component, int w, int h) { g.setPaint(calculateStrokePaint(component, w, h)); g.draw(shape); }
g.setStroke(new BasicStroke(this.getBorderWidth())); if(getShape() != null) { Shape s = provideShape(g,component, w, h); Rectangle bounds = s.getBounds(); Rectangle rect = calculateLayout(bounds.width, bounds.height, w, h); g.translate(rect.x, rect.y); drawPathEffects(g, s, rect.width, rect.height); switch (getStyle()) { case BOTH: drawShape(g, s, component, rect.width, rect.height); fillShape(g, s, component, rect.width, rect.height); break; case FILLED: fillShape(g, s, component, rect.width, rect.height); break; case OUTLINE: drawShape(g, s, component, rect.width, rect.height); break;
private Paint calculateFillPaint(Object component, int width, int height) { //set the fillPaint Paint p = getBackgroundPaint(getFillPaint(), component); if(isPaintStretched()) { p = calculateSnappedPaint(p, width, height); } return p; }
private Paint calculateStrokePaint(Object component, int width, int height) { Paint p = getForegroundPaint(getBorderPaint(), component); if(isPaintStretched()) { p = calculateSnappedPaint(p, width, height); } return p; }
/** * Sets the shape to fillPaint. This shape is not resized when the component * bounds are. To do that, create a custom shape that is bound to the * component width/height * * * @param s the Shape to fillPaint. May be null */ public void setShape(Shape s) { Shape old = getShape(); this.shape = s; setDirty(true); firePropertyChange("shape", old, getShape()); }
private void drawPathEffects(Graphics2D g, Shape s, int w, int h) { if(getAreaEffects() != null) { //Paint pt = calculateFillPaint(component, w, h); for(AreaEffect ef : getAreaEffects()) { ef.apply(g, s, w, h); } } } }
private void fillShape(Graphics2D g, Shape shape, Object component, int w, int h) { g.setPaint(calculateFillPaint(component, w, h)); g.fill(shape); }
private void drawShape(Graphics2D g, Shape s, Object component, int w, int h) { g.setPaint(calculateStrokePaint(component, w, h)); g.draw(s); }
Stroke s = new BasicStroke(this.getBorderWidth()); g.setStroke(s); if(getShape() != null) { Shape shape = provideShape(g,component, w, h); Rectangle bounds = shape.getBounds(); Rectangle rect = calculateLayout(bounds.width, bounds.height, w, h); g.translate(rect.x, rect.y); drawPathEffects(g, shape, rect.width, rect.height); switch (getStyle()) { case BOTH: drawShape(g, shape, component, rect.width, rect.height); fillShape(g, shape, component, rect.width, rect.height); break; case FILLED: fillShape(g, shape, component, rect.width, rect.height); break; case OUTLINE: drawShape(g, shape, component, rect.width, rect.height); break;
private Paint calculateFillPaint(Object component, int width, int height) { //set the fillPaint Paint p = getBackgroundPaint(getFillPaint(), component); if(isPaintStretched()) { p = calculateSnappedPaint(p, width, height); } return p; }