/** * Sets the angle, in degrees, at which to paint the pinstripes. If the given angle is < 0 or > * 360, it will be appropriately constrained. For example, if a value of 365 is given, it will * result in 5 degrees. The conversion is not perfect, but "a man on a galloping horse won't be * able to tell the difference". * * @param angle * the Angle in degrees at which to paint the pinstripes */ public void setAngle(double angle) { if (angle > 360) { angle = angle % 360; } if (angle < 0) { angle = 360 - ((angle * -1) % 360); } double old = getAngle(); this.angle = angle; firePropertyChange("angle", old, getAngle()); }
/** * Set the paint to use for drawing the pinstripes * * @param p * the Paint to use. May be a Color. */ public void setPaint(Paint p) { Paint old = getPaint(); this.paint = p; firePropertyChange("paint", old, getPaint()); }
/** * Sets the spacing between pinstripes * * @param spacing * spacing between pinstripes */ public void setSpacing(double spacing) { double old = getSpacing(); this.spacing = spacing; firePropertyChange("spacing", old, getSpacing()); }
/** * Set the width of the pinstripes * * @param stripeWidth * a new width for the pinstripes */ public void setStripeWidth(double stripeWidth) { double oldSripeWidth = getStripeWidth(); this.stripeWidth = stripeWidth; firePropertyChange("stripeWidth", oldSripeWidth, getStripeWidth()); }
g.setPaint(getForegroundPaint(getPaint(), component)); g.setStroke(new BasicStroke((float) getStripeWidth())); g.rotate(toRadians(getAngle())); double gap = getSpacing() + getStripeWidth();
private void setupPainters() { //Tom doesnt like the gloss :) // GlossPainter gloss = new GlossPainter(new Color(1.0f, 1.0f, 1.0f, 0.2f), // GlossPainter.GlossPosition.TOP); PinstripePainter stripes = new PinstripePainter(); stripes.setPaint(new Color(1.0f, 1.0f, 1.0f, 0.17f)); stripes.setSpacing(5.0); MattePainter matte = new MattePainter(COLOR_BASE); setBackgroundPainter(new CompoundPainter(matte, stripes)); }
/** * {@inheritDoc} */ @Override protected PinstripePainter createTestingPainter() { return new PinstripePainter(); }
g.setClip(area); Paint p = getPaint(); if (p == null) { if(component instanceof JComponent) { g.setStroke(new BasicStroke((float)getStripeWidth())); double radians = Math.toRadians(getAngle()); g.rotate(radians); double spacing = getSpacing(); spacing += getStripeWidth(); int numLines = (int)(hypLength / spacing);
/** * Set the width of the pinstripes * * @param stripeWidth * a new width for the pinstripes */ public void setStripeWidth(double stripeWidth) { double oldSripeWidth = getStripeWidth(); this.stripeWidth = stripeWidth; firePropertyChange("stripeWidth", oldSripeWidth, getStripeWidth()); }
legendColorPanel.setAlpha(.8f); PinstripePainter stripes = new PinstripePainter(); stripes.setPaint(new Color(1.0f, 1.0f, 1.0f, 0.17f)); stripes.setSpacing(5.0);
/** * Gets the compound painter. * * @param color * the color * @param position * the position * @param angle * the angle * @return the compound painter */ @SuppressWarnings("rawtypes") public static CompoundPainter getCompoundPainter(final Color color, final GlossPainter.GlossPosition position, final double angle) { final MattePainter mp = new MattePainter(color); final GlossPainter gp = new GlossPainter(color, position); final PinstripePainter pp = new PinstripePainter(color, angle); final CompoundPainter compoundPainter = new CompoundPainter(mp, pp, gp); return compoundPainter; }
g.setPaint(getForegroundPaint(getPaint(), component)); g.setStroke(new BasicStroke((float) getStripeWidth())); g.rotate(toRadians(getAngle())); double gap = getSpacing() + getStripeWidth();
/** * Sets the spacing between pinstripes * * @param spacing * spacing between pinstripes */ public void setSpacing(double spacing) { double old = getSpacing(); this.spacing = spacing; firePropertyChange("spacing", old, getSpacing()); }
/** * Set the width of the pinstripes * * @param stripeWidth * a new width for the pinstripes */ public void setStripeWidth(double stripeWidth) { double oldSripeWidth = getStripeWidth(); this.stripeWidth = stripeWidth; firePropertyChange("stripeWidth", oldSripeWidth, getStripeWidth()); }
/** * Set the paint to use for drawing the pinstripes * * @param p * the Paint to use. May be a Color. */ public void setPaint(Paint p) { Paint old = getPaint(); this.paint = p; firePropertyChange("paint", old, getPaint()); }
/** * Sets the angle, in degrees, at which to paint the pinstripes. If the given angle is < 0 or > * 360, it will be appropriately constrained. For example, if a value of 365 is given, it will * result in 5 degrees. The conversion is not perfect, but "a man on a galloping horse won't be * able to tell the difference". * * @param angle * the Angle in degrees at which to paint the pinstripes */ public void setAngle(double angle) { if (angle > 360) { angle = angle % 360; } if (angle < 0) { angle = 360 - ((angle * -1) % 360); } double old = getAngle(); this.angle = angle; firePropertyChange("angle", old, getAngle()); }
/** * Gets a CompoundPainter object. * * @param matte * the matte color * @param gloss * the gloss color * @param position * the position * @param angle * the angle * @param pinstripe * the pinstripe painter * @return the CompoundPainter object. */ @SuppressWarnings("rawtypes") public static CompoundPainter getCompoundPainter(final Color matte, final Color gloss, final GlossPainter.GlossPosition position, final double angle, final Color pinstripe) { final MattePainter mp = new MattePainter(matte); final GlossPainter gp = new GlossPainter(gloss, position); final PinstripePainter pp = new PinstripePainter(pinstripe, angle); final CompoundPainter compoundPainter = new CompoundPainter(mp, pp, gp); return compoundPainter; }
g.setPaint(getForegroundPaint(getPaint(), component)); g.setStroke(new BasicStroke((float) getStripeWidth())); g.rotate(toRadians(getAngle())); double gap = getSpacing() + getStripeWidth();
/** * Sets the spacing between pinstripes * * @param spacing * spacing between pinstripes */ public void setSpacing(double spacing) { double old = getSpacing(); this.spacing = spacing; firePropertyChange("spacing", old, getSpacing()); }
/** * Set the width of the pinstripes * @param stripeWidth a new width for the pinstripes */ public void setStripeWidth(double stripeWidth) { double oldSripeWidth = getStripeWidth(); this.stripeWidth = stripeWidth; firePropertyChange("stripeWidth",new Double(oldSripeWidth),new Double(stripeWidth)); }