/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }
g.setPaint(getForegroundPaint(getPaint(), component)); g.setStroke(new BasicStroke((float) getStripeWidth())); g.rotate(toRadians(getAngle()));
g.setPaint(getForegroundPaint(getPaint(), component)); g.setStroke(new BasicStroke((float) getStripeWidth())); g.rotate(toRadians(getAngle()));
g.setPaint(getForegroundPaint(getPaint(), component)); g.setStroke(new BasicStroke((float) getStripeWidth())); g.rotate(toRadians(getAngle()));
(height * height)); double radians = Math.toRadians(getAngle()); g.rotate(radians);
@Test @Override public void testDefaults() { super.testDefaults(); PinstripePainter pp = (PinstripePainter) p; assertThat(pp.getAngle(), is(45d)); assertThat(pp.getPaint(), is(nullValue())); assertThat(pp.getSpacing(), is(8d)); assertThat(pp.getStripeWidth(), is(1d)); } }