/** * Sets the path effects to be drawn on this painter. Set this to null in order to remove all installed effects. * @param areaEffects the effects to apply to this painter */ public void setAreaEffects(AreaEffect... areaEffects) { AreaEffect[] old = getAreaEffects(); this.areaEffects = new AreaEffect[areaEffects == null ? 0 : areaEffects.length]; if (areaEffects != null) { System.arraycopy(areaEffects, 0, this.areaEffects, 0, this.areaEffects.length); } setDirty(true); firePropertyChange("areaEffects", old, getAreaEffects()); }
/** * The Paint to use for stroking the shape (painting the outline). * Can be a Color, GradientPaint, TexturePaint, or any other kind of Paint. * If null, the component foreground is used. * * @param p the Paint to use for stroking the shape. May be null. */ public void setBorderPaint(Paint p) { Paint old = getBorderPaint(); this.borderPaint = p; setDirty(true); firePropertyChange("borderPaint", old, getBorderPaint()); }
/** * Sets the border width to use for painting. If null, then the default Graphics2D * stroke will be used. The stroke will be centered on the actual shape outline. * @param s the Stroke to fillPaint with */ public void setBorderWidth(float s) { float old = getBorderWidth(); this.borderWidth = s; setDirty(true); firePropertyChange("borderWidth", old, getBorderWidth()); }
/** * The shape can be filled or simply stroked (outlined), or both or none. By default, * the shape is both filled and stroked. This property specifies the strategy to * use. * @param s the Style to use. If null, Style.BOTH is used */ public void setStyle(Style s) { Style old = getStyle(); this.style = s == null ? Style.BOTH : s; setDirty(true); firePropertyChange("style", old, getStyle()); }
/** * Sets the Paint to use. This is the Paint object that will be used to fill the path area. If null, nothing is painted * @param p the Paint to use */ public void setFillPaint(Paint p) { Paint old = getFillPaint(); this.fillPaint = p; setDirty(true); firePropertyChange("paint", old, getFillPaint()); }
@Test @Override public void testDefaults() { super.testDefaults(); AbstractAreaPainter aap = (AbstractAreaPainter) p; assertThat(aap.getAreaEffects(), is(new AreaEffect[0])); assertThat(aap.getBorderPaint(), is(nullValue())); assertThat(aap.getBorderWidth(), is(0f)); assertThat(aap.getFillPaint(), CoreMatchers.<Paint>is(Color.RED)); assertThat(aap.getStyle(), is(AbstractAreaPainter.Style.BOTH)); } }
/** * Specifies whether this Painter should attempt to resize the Paint to fit the area being painted. * For example, if true, then a gradient specified as (0, 0), (1, 0) would stretch horizontally such that * the beginning of the gradient is on the left edge of the painted region, and the end of the gradient * is at the right edge of the painted region. * Specifically, if true, the resizePaint method will be called to perform the actual resizing of the Paint * @param paintStretched true if the paint should be stretched, false otherwise. */ public void setPaintStretched(boolean paintStretched) { boolean old = this.isPaintStretched(); this.stretchPaint = paintStretched; setDirty(true); firePropertyChange("paintStretched", old, isPaintStretched()); }
assertThat(aap.getAreaEffects(), is(new AreaEffect[0])); assertThat(aap.getBorderPaint(), CoreMatchers.<Paint>is(Color.BLACK)); assertThat(aap.getBorderWidth(), is(1f)); assertThat(aap.getFillPaint(), CoreMatchers.<Paint>is(Color.RED)); assertThat(aap.getStyle(), is(AbstractAreaPainter.Style.BOTH));
/** * The shape can be filled or simply stroked (outlined), or both or none. By default, * the shape is both filled and stroked. This property specifies the strategy to * use. * @param s the Style to use. If null, Style.BOTH is used */ public void setStyle(Style s) { Style old = getStyle(); this.style = s == null ? Style.BOTH : s; setDirty(true); firePropertyChange("style", old, getStyle()); }
/** * Sets the Paint to use. This is the Paint object that will be used to fill the path area. If null, nothing is painted * @param p the Paint to use */ public void setFillPaint(Paint p) { Paint old = getFillPaint(); this.fillPaint = p; setDirty(true); firePropertyChange("fillPaint", old, getFillPaint()); }
/** * Specifies whether this Painter should attempt to resize the Paint to fit the area being painted. * For example, if true, then a gradient specified as (0, 0), (1, 0) would stretch horizontally such that * the beginning of the gradient is on the left edge of the painted region, and the end of the gradient * is at the right edge of the painted region. * Specifically, if true, the resizePaint method will be called to perform the actual resizing of the Paint * @param paintStretched true if the paint should be stretched, false otherwise. */ public void setPaintStretched(boolean paintStretched) { boolean old = this.isPaintStretched(); this.stretchPaint = paintStretched; setDirty(true); firePropertyChange("paintStretched", old, isPaintStretched()); }
assertThat(aap.getAreaEffects(), is(new AreaEffect[0])); assertThat(aap.getBorderPaint(), is(nullValue())); assertThat(aap.getBorderWidth(), is(0f)); assertThat(aap.getFillPaint(), is(nullValue())); assertThat(aap.getStyle(), is(AbstractAreaPainter.Style.BOTH));
/** * The shape can be filled or simply stroked (outlined), or both or none. By default, * the shape is both filled and stroked. This property specifies the strategy to * use. * @param s the Style to use. If null, Style.BOTH is used */ public void setStyle(Style s) { Style old = getStyle(); this.style = s == null ? Style.BOTH : s; setDirty(true); firePropertyChange("style", old, getStyle()); }
/** * Sets the path effects to be drawn on this painter. Set this to null in order to remove all installed effects. * @param areaEffects the effects to apply to this painter */ public void setAreaEffects(AreaEffect... areaEffects) { AreaEffect[] old = getAreaEffects(); this.areaEffects = new AreaEffect[areaEffects == null ? 0 : areaEffects.length]; if (areaEffects != null) { System.arraycopy(areaEffects, 0, this.areaEffects, 0, this.areaEffects.length); } setDirty(true); firePropertyChange("areaEffects", old, getAreaEffects()); }
/** * Sets the Paint to use. This is the Paint object that will be used to fill the path area. If null, nothing is painted * @param p the Paint to use */ public void setFillPaint(Paint p) { Paint old = getFillPaint(); this.fillPaint = p; setDirty(true); firePropertyChange("fillPaint", old, getFillPaint()); }
/** * Sets the border width to use for painting. If null, then the default Graphics2D * stroke will be used. The stroke will be centered on the actual shape outline. * @param s the Stroke to fillPaint with */ public void setBorderWidth(float s) { float old = getBorderWidth(); this.borderWidth = s; setDirty(true); firePropertyChange("strokeWidth", old, getBorderWidth()); }
/** * The Paint to use for stroking the shape (painting the outline). * Can be a Color, GradientPaint, TexturePaint, or any other kind of Paint. * If null, the component foreground is used. * * @param p the Paint to use for stroking the shape. May be null. */ public void setBorderPaint(Paint p) { Paint old = getBorderPaint(); this.borderPaint = p; setDirty(true); firePropertyChange("borderPaint", old, getBorderPaint()); }
/** * Specifies whether this Painter should attempt to resize the Paint to fit the area being painted. * For example, if true, then a gradient specified as (0, 0), (1, 0) would stretch horizontally such that * the beginning of the gradient is on the left edge of the painted region, and the end of the gradient * is at the right edge of the painted region. * Specifically, if true, the resizePaint method will be called to perform the actual resizing of the Paint * @param paintStretched true if the paint should be stretched, false otherwise. */ public void setPaintStretched(boolean paintStretched) { boolean old = this.isPaintStretched(); this.stretchPaint = paintStretched; setDirty(true); firePropertyChange("snapPaint",old,this.stretchPaint); }
/** * The shape can be filled or simply stroked (outlined), or both or none. By default, * the shape is both filled and stroked. This property specifies the strategy to * use. * @param s the Style to use. If null, Style.BOTH is used */ public void setStyle(Style s) { Style old = getStyle(); this.style = s == null ? Style.BOTH : s; setDirty(true); firePropertyChange("style", old, getStyle()); }
/** * Sets the path effects to be drawn on this painter. Set this to null in order to remove all installed effects. * @param areaEffects the effects to apply to this painter */ public void setAreaEffects(AreaEffect... areaEffects) { AreaEffect[] old = getAreaEffects(); this.areaEffects = new AreaEffect[areaEffects == null ? 0 : areaEffects.length]; if (areaEffects != null) { System.arraycopy(areaEffects, 0, this.areaEffects, 0, this.areaEffects.length); } setDirty(true); firePropertyChange("areaEffects", old, getAreaEffects()); }