/** * <p>Changes the paint to be used to fill the gloss. When the specified * paint is null, nothing is painted. A paint can be an instance of * Color.</p> * * @param paint The Paint instance to be used to fill the gloss */ public void setPaint(Paint paint) { Paint old = this.paint; this.paint = paint; setDirty(true); firePropertyChange("paint", old, getPaint()); }
/** * <p>Changes the position of the gloss in the painted area. Only the * values defined in the GlossPosition enum are valid.</p> * * @param position The position at which the gloss is painted */ public void setPosition(GlossPosition position) { GlossPosition old = this.position; this.position = position; setDirty(true); firePropertyChange("position", old, getPosition()); } }
/** * <p>Creates a new gloss painter positioned at the specified position * and painted with the specified paint.</p> * * @param paint The paint to be used when filling the gloss * @param position The position of the gloss on the painted area */ public GlossPainter(Paint paint, GlossPosition position) { this.setPaint(paint); this.setPosition(position); }
/** * {@inheritDoc} */ @Override protected void doPaint(Graphics2D g, Object component, int width, int height) { if (getPaint() != null) { Ellipse2D ellipse = new Ellipse2D.Double(-width / 2.0, height / 2.7, width * 2.0, height * 2.0); Area gloss = new Area(ellipse); if (getPosition() == GlossPosition.TOP) { Area area = new Area(new Rectangle(0, 0, width, height)); area.subtract(new Area(ellipse)); gloss = area; } /* if(getClip() != null) { gloss.intersect(new Area(getClip())); }*/ g.setPaint(getPaint()); g.fill(gloss); } }
/** * {@inheritDoc} */ @Override protected GlossPainter createTestingPainter() { return new GlossPainter(); }
/** * {@inheritDoc} */ @Override protected void doPaint(Graphics2D g, Object component, int width, int height) { if (getPaint() != null) { Ellipse2D ellipse = new Ellipse2D.Double(-width / 2.0, height / 2.7, width * 2.0, height * 2.0); Area gloss = new Area(ellipse); if (getPosition() == GlossPosition.TOP) { Area area = new Area(new Rectangle(0, 0, width, height)); area.subtract(new Area(ellipse)); gloss = area; } /* if(getClip() != null) { gloss.intersect(new Area(getClip())); }*/ g.setPaint(getPaint()); g.fill(gloss); } }
@Override public void mouseEntered(MouseEvent e) { homeButton.setBackgroundPainter(new org.jdesktop.swingx.painter.CompoundPainter<JXButton>(new MattePainter((Color) UIManager.getLookAndFeelDefaults().get("Button.light")), new GlossPainter())); }
/** * <p>Changes the paint to be used to fill the gloss. When the specified * paint is null, nothing is painted. A paint can be an instance of * Color.</p> * * @param paint The Paint instance to be used to fill the gloss */ public void setPaint(Paint paint) { Paint old = this.paint; this.paint = paint; setDirty(true); firePropertyChange("paint", old, getPaint()); }
/** * <p>Changes the position of the gloss in the painted area. Only the * values defined in the GlossPosition enum are valid.</p> * * @param position The position at which the gloss is painted */ public void setPosition(GlossPosition position) { GlossPosition old = this.position; this.position = position; setDirty(true); firePropertyChange("position", old, getPosition()); } }
/** * {@inheritDoc} */ @Override protected void doPaint(Graphics2D g, Object component, int width, int height) { if (getPaint() != null) { Ellipse2D ellipse = new Ellipse2D.Double(-width / 2.0, height / 2.7, width * 2.0, height * 2.0); Area gloss = new Area(ellipse); if (getPosition() == GlossPosition.TOP) { Area area = new Area(new Rectangle(0, 0, width, height)); area.subtract(new Area(ellipse)); gloss = area; } /* if(getClip() != null) { gloss.intersect(new Area(getClip())); }*/ g.setPaint(getPaint()); g.fill(gloss); } }
/** * <p>Creates a new gloss painter positioned at the specified position * and painted with the specified paint.</p> * * @param paint The paint to be used when filling the gloss * @param position The position of the gloss on the painted area */ public GlossPainter(Paint paint, GlossPosition position) { this.setPaint(paint); this.setPosition(position); }
/** * 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; }
/** * <p>Changes the paint to be used to fill the gloss. When the specified * paint is null, nothing is painted. A paint can be an instance of * Color.</p> * * @param paint The Paint instance to be used to fill the gloss */ public void setPaint(Paint paint) { Paint old = this.paint; this.paint = paint; setDirty(true); firePropertyChange("paint", old, getPaint()); }
/** * <p>Changes the position of the gloss in the painted area. Only the * values defined in the GlossPosition enum are valid.</p> * * @param position The position at which the gloss is painted */ public void setPosition(GlossPosition position) { GlossPosition old = this.position; this.position = position; setDirty(true); firePropertyChange("position", old, getPosition()); } }
/** * {@inheritDoc} */ @Override protected void doPaint(Graphics2D g, Object component, int width, int height) { if (getPaint() != null) { Ellipse2D ellipse = new Ellipse2D.Double(-width / 2.0, height / 2.7, width * 2.0, height * 2.0); Area gloss = new Area(ellipse); if (getPosition() == GlossPosition.TOP) { Area area = new Area(new Rectangle(0, 0, width, height)); area.subtract(new Area(ellipse)); gloss = area; } /* if(getClip() != null) { gloss.intersect(new Area(getClip())); }*/ g.setPaint(getPaint()); g.fill(gloss); } }
/** * <p>Creates a new gloss painter positioned at the specified position * and painted with the specified paint.</p> * * @param paint The paint to be used when filling the gloss * @param position The position of the gloss on the painted area */ public GlossPainter(Paint paint, GlossPosition position) { this.setPaint(paint); this.setPosition(position); }
/** * 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; }
/** * <p>Changes the paint to be used to fill the gloss. When the specified * paint is null, nothing is painted. A paint can be an instance of * Color.</p> * * @param paint The Paint instance to be used to fill the gloss */ public void setPaint(Paint paint) { Paint old = this.paint; this.paint = paint; setDirty(true); firePropertyChange("paint", old, getPaint()); }
/** * <p>Changes the position of the gloss in the painted area. Only the * values defined in the GlossPosition enum are valid.</p> * * @param position The position at which the gloss is painted */ public void setPosition(GlossPosition position) { GlossPosition old = this.position; this.position = position; setDirty(true); firePropertyChange("position", old, getPosition()); } }
/** * {@inheritDoc} * <p> * Overridden for GlossPainter defaults. */ @Test @Override public void testDefaults() { //TODO replace with super.testDefaults() when corrected copyOfSuper_testDefaultsWithCorrectedValues(); // super.testDefaults(); GlossPainter gp = (GlossPainter) p; assertThat(gp.getPaint(), CoreMatchers.<Paint>is(new Color(1f, 1f, 1f, .2f))); assertThat(gp.getPosition(), is(GlossPainter.GlossPosition.TOP)); } }