/** * Specifies the paint to use for light tiles. This is a Paint and * may be anything, including a TexturePaint for painting images. If null, * the foreground color of the component is used. * * @param color the Paint to use for painting the "light" tiles. May be null. */ public void setLightPaint(Paint color) { Paint old = getLightPaint(); this.lightPaint = color; checkerPaint = null; setDirty(true); firePropertyChange("lightPaint", old, getLightPaint()); }
/** * Specifies the paint to use for light tiles. This is a Paint and * may be anything, including a TexturePaint for painting images. If null, * the foreground color of the component is used. * * @param color the Paint to use for painting the "light" tiles. May be null. */ public void setLightPaint(Paint color) { Paint old = getLightPaint(); this.lightPaint = color; checkerPaint = null; setDirty(true); firePropertyChange("lightPaint", old, getLightPaint()); }
/** * Specifies the paint to use for light tiles. This is a Paint and * may be anything, including a TexturePaint for painting images. If null, * the foreground color of the component is used. * * @param color the Paint to use for painting the "light" tiles. May be null. */ public void setLightPaint(Paint color) { Paint old = getLightPaint(); this.lightPaint = color; checkerPaint = null; setDirty(true); firePropertyChange("lightPaint", old, getLightPaint()); }
/** * Specifies the paint to use for light tiles. This is a Paint and * may be anything, including a TexturePaint for painting images. If null, * the foreground color of the component is used. * * @param color the Paint to use for painting the "light" tiles. May be null. */ public void setLightPaint(Paint color) { Paint old = getLightPaint(); this.lightPaint = color; checkerPaint = null; setDirty(true); firePropertyChange("lightPaint", old, getLightPaint()); }
Paint p = getLightPaint(); if (p == null && c instanceof JComponent) { p = ((JComponent)c).getForeground();
/** * Helper method that creates and returns the Paint that incorporates the * sizes and light and dark Paints in one TexturePaint. I may want to cache * this value in the future for performance reasons */ private Paint getCheckerPaint(Object c) { if (checkerPaint == null) { Paint p1 = PainterUtils.getForegroundPaint(getLightPaint(), c); Paint p2 = PainterUtils.getBackgroundPaint(getDarkPaint(), c); checkerPaint = PaintUtils.getCheckerPaint(p1, p2, (int)(getSquareSize() * 2)); } return checkerPaint; }
/** * Helper method that creates and returns the Paint that incorporates the * sizes and light and dark Paints in one TexturePaint. I may want to cache * this value in the future for performance reasons */ private Paint getCheckerPaint(Object c) { if (checkerPaint == null) { Paint p1 = PainterUtils.getForegroundPaint(getLightPaint(), c); Paint p2 = PainterUtils.getBackgroundPaint(getDarkPaint(), c); checkerPaint = PaintUtils.getCheckerPaint(p1, p2, (int)(getSquareSize() * 2)); } return checkerPaint; }
/** * Helper method that creates and returns the Paint that incorporates the * sizes and light and dark Paints in one TexturePaint. I may want to cache * this value in the future for performance reasons */ private Paint getCheckerPaint(Object c) { if (checkerPaint == null) { Paint p1 = PainterUtils.getForegroundPaint(getLightPaint(), c); Paint p2 = PainterUtils.getBackgroundPaint(getDarkPaint(), c); checkerPaint = PaintUtils.getCheckerPaint(p1, p2, (int)(getSquareSize() * 2)); } return checkerPaint; }
@Test @Override public void testDefaults() { super.testDefaults(); CheckerboardPainter cp = (CheckerboardPainter) p; assertThat(cp.getDarkPaint(), CoreMatchers.<Paint>is(new Color(204, 204, 204))); assertThat(cp.getLightPaint(), CoreMatchers.<Paint>is(Color.WHITE)); assertThat(cp.getSquareSize(), is(8d)); } }