org.jdesktop.swingx.painter.MattePainter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swingx-all Show documentation
Show all versions of swingx-all Show documentation
A Maven project to aggregate all modules into a single artifact.
/*
* $Id: MattePainter.java 4147 2012-02-01 17:13:24Z kschaefe $
*
* Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
* Santa Clara, California 95054, U.S.A. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.jdesktop.swingx.painter;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.Shape;
import org.jdesktop.beans.JavaBean;
/**
* A Painter implementation that uses a Paint to fill the entire background
* area. For example, if I wanted to paint the entire background of a panel green, I would:
*
* MattePainter p = new MattePainter(Color.GREEN);
* panel.setBackgroundPainter(p);
*
*
* Since it accepts a Paint, it is also possible to paint a texture or use other
* more exotic Paint implementations. To paint a BufferedImage texture as the
* background:
*
* TexturePaint paint = new TexturePaint(bufferedImage,
* new Rectangle2D.Double(0, 0, bufferedImage.getWidth(), bufferedImage.getHeight()));
* MattePainter p = new MattePainter(paint);
* panel.setBackgroundPainter(p);
*
*
* If no paint is specified, then nothing is painted
* @author rbair
*/
@JavaBean
public class MattePainter extends AbstractAreaPainter