Documentation of 'org.jdesktop.swingx.painter.MattePainter' Java class
MattePainter
org.jdesktop.swingx.painter

Class MattePainter

  • All Implemented Interfaces:
    Painter<java.lang.Object>


    @JavaBean
    public class MattePainter
    extends AbstractAreaPainter<java.lang.Object>
    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

    • Constructor Detail

      • MattePainter

        public MattePainter()
        Creates a new MattePainter with "null" as the paint used
      • MattePainter

        public MattePainter(java.awt.Paint paint)
        Create a new MattePainter for the given Paint. This can be a GradientPaint (the gradient will not grow when the component becomes larger unless you use the paintStretched boolean property), TexturePaint, Color, or other Paint instance.
        Parameters:
        paint - Paint to fill with
      • MattePainter

        public MattePainter(java.awt.Paint paint,
                            boolean paintStretched)
        Create a new MattePainter for the given Paint. This can be a GradientPaint (the gradient will not grow when the component becomes larger unless you use the paintStretched boolean property), TexturePaint, Color, or other Paint instance.
        Parameters:
        paint - Paint to fill with
        paintStretched - indicates if the paint should be stretched

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.