public void fillColorBackground(){
  Graphics2D g2D=m_backImage.createGraphics();
  if (isGradient()) {
    Point start=null;
    Point end=null;
    int r=1;
switch (m_startPoint) {
case SwingConstants.NORTH_WEST:
      start=new Point(0,0);
    if (m_repeatDistance > 0)     end=new Point(m_repeatDistance,m_repeatDistance);
 else     end=new Point(m_width / r,m_height / r);
  break;
case SwingConstants.WEST:
start=new Point(0,m_height / 2);
if (m_repeatDistance > 0) end=new Point(m_repeatDistance,m_height / 2);
 else end=new Point(m_width / r,m_height / 2);
break;
case SwingConstants.SOUTH_WEST:
start=new Point(0,m_height);
if (m_repeatDistance > 0) end=new Point(m_repeatDistance,m_height - m_repeatDistance);
 else end=new Point(m_width / r,m_height - (m_height / r));
break;
case SwingConstants.SOUTH:
start=new Point(0,m_height);
if (m_repeatDistance > 0) end=new Point(0,m_height - m_repeatDistance);
 else end=new Point(0,m_height - (m_height / r));
break;
case SwingConstants.SOUTH_EAST:
start=new Point(m_width,m_height);
if (m_repeatDistance > 0) end=new Point(m_width - m_repeatDistance,m_height - m_repeatDistance);
 else end=new Point(m_width - (m_width / r),m_height - (m_height / r));
break;
case SwingConstants.EAST:
start=new Point(m_width,m_height / 2);
if (m_repeatDistance > 0) end=new Point(m_width - m_repeatDistance,m_height / 2);
 else end=new Point(m_width - (m_width / r),m_height / 2);
break;
case SwingConstants.NORTH_EAST:
start=new Point(m_width,0);
if (m_repeatDistance > 0) end=new Point(m_width - m_repeatDistance,m_repeatDistance);
 else end=new Point(m_width - (m_width / r),m_height / r);
break;
default :
case SwingConstants.NORTH:
start=new Point(0,0);
if (m_repeatDistance > 0) end=new Point(0,m_repeatDistance);
 else end=new Point(0,m_height / r);
}
GradientPaint paint=new GradientPaint(start,ColorBlind.getDichromatColor(getGradientUpperColor()),end,ColorBlind.getDichromatColor(getGradientLowerColor()),true);
g2D.setPaint(paint);
g2D.fillRect(0,0,m_width,m_height);
}
 else if (isTexture()) {
BufferedImage image=getTextureImage();
if (image == null) {
g2D.setPaint(ColorBlind.getDichromatColor(getFlatColor()));
g2D.fillRect(0,0,m_width,m_height);
}
 else {
Rectangle anchor=new Rectangle(0,0,image.getWidth(),image.getHeight());
TexturePaint texture=new TexturePaint(image,anchor);
g2D.setPaint(texture);
g2D.fillRect(0,0,m_width,m_height);
g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,getTextureCompositeAlpha()));
g2D.setPaint(ColorBlind.getDichromatColor(getTextureTaintColor()));
g2D.fillRect(0,0,m_width,m_height);
}
}
 else if (isLine()) {
g2D.setPaint(ColorBlind.getDichromatColor(getLineBackColor()));
g2D.fillRect(0,0,m_width,m_height);
g2D.setPaint(ColorBlind.getDichromatColor(getLineColor()));
g2D.setStroke(new BasicStroke(getLineWidth()));
for (int y=0; y < m_height; y+=getLineDistance()) g2D.drawLine(0,y,m_width,y);
}
 else {
g2D.setPaint(ColorBlind.getDichromatColor(getFlatColor()));
g2D.fillRect(0,0,m_width,m_height);
}
setDirty(false);
}

public void fillColorBackground ( ) { Graphics2D g2D = m_backImage . createGraphics ( ) ; if ( isGradient ( ) ) { Point start = null ; Point end = null ; int r = 1 ; switch ( m_startPoint ) { case SwingConstants . NORTH_WEST : start = new Point ( 0 , 0 ) ; if ( m_repeatDistance > 0 ) end = new Point ( m_repeatDistance , m_repeatDistance ) ; else end = new Point ( m_width / r , m_height / r ) ; break ; case SwingConstants . WEST : start = new Point ( 0 , m_height / 2 ) ; if ( m_repeatDistance > 0 ) end = new Point ( m_repeatDistance , m_height / 2 ) ; else end = new Point ( m_width / r , m_height / 2 ) ; break ; case SwingConstants . SOUTH_WEST : start = new Point ( 0 , m_height ) ; if ( m_repeatDistance > 0 ) end = new Point ( m_repeatDistance , m_height - m_repeatDistance ) ; else end = new Point ( m_width / r , m_height - ( m_height / r ) ) ; break ; case SwingConstants . SOUTH : start = new Point ( 0 , m_height ) ; if ( m_repeatDistance > 0 ) end = new Point ( 0 , m_height - m_repeatDistance ) ; else end = new Point ( 0 , m_height - ( m_height / r ) ) ; break ; case SwingConstants . SOUTH_EAST : start = new Point ( m_width , m_height ) ; if ( m_repeatDistance > 0 ) end = new Point ( m_width - m_repeatDistance , m_height - m_repeatDistance ) ; else end = new Point ( m_width - ( m_width / r ) , m_height - ( m_height / r ) ) ; break ; case SwingConstants . EAST : start = new Point ( m_width , m_height / 2 ) ; if ( m_repeatDistance > 0 ) end = new Point ( m_width - m_repeatDistance , m_height / 2 ) ; else end = new Point ( m_width - ( m_width / r ) , m_height / 2 ) ; break ; case SwingConstants . NORTH_EAST : start = new Point ( m_width , 0 ) ; if ( m_repeatDistance > 0 ) end = new Point ( m_width - m_repeatDistance , m_repeatDistance ) ; else end = new Point ( m_width - ( m_width / r ) , m_height / r ) ; break ; default : case SwingConstants . NORTH : start = new Point ( 0 , 0 ) ; if ( m_repeatDistance > 0 ) end = new Point ( 0 , m_repeatDistance ) ; else end = new Point ( 0 , m_height / r ) ; } GradientPaint paint = new GradientPaint ( start , ColorBlind . getDichromatColor ( getGradientUpperColor ( ) ) , end , ColorBlind . getDichromatColor ( getGradientLowerColor ( ) ) , true ) ; g2D . setPaint ( paint ) ; g2D . fillRect ( 0 , 0 , m_width , m_height ) ; } else if ( isTexture ( ) ) { BufferedImage image = getTextureImage ( ) ; if ( image == null ) { g2D . setPaint ( ColorBlind . getDichromatColor ( getFlatColor ( ) ) ) ; g2D . fillRect ( 0 , 0 , m_width , m_height ) ; } else { Rectangle anchor = new Rectangle ( 0 , 0 , image . getWidth ( ) , image . getHeight ( ) ) ; TexturePaint texture = new TexturePaint ( image , anchor ) ; g2D . setPaint ( texture ) ; g2D . fillRect ( 0 , 0 , m_width , m_height ) ; g2D . setComposite ( AlphaComposite . getInstance ( AlphaComposite . SRC_OVER , getTextureCompositeAlpha ( ) ) ) ; g2D . setPaint ( ColorBlind . getDichromatColor ( getTextureTaintColor ( ) ) ) ; g2D . fillRect ( 0 , 0 , m_width , m_height ) ; } } else if ( isLine ( ) ) { g2D . setPaint ( ColorBlind . getDichromatColor ( getLineBackColor ( ) ) ) ; g2D . fillRect ( 0 , 0 , m_width , m_height ) ; g2D . setPaint ( ColorBlind . getDichromatColor ( getLineColor ( ) ) ) ; g2D . setStroke ( new BasicStroke ( getLineWidth ( ) ) ) ; for ( int y = 0 ; y < m_height ; y += getLineDistance ( ) ) g2D . drawLine ( 0 , y , m_width , y ) ; } else { g2D . setPaint ( ColorBlind . getDichromatColor ( getFlatColor ( ) ) ) ; g2D . fillRect ( 0 , 0 , m_width , m_height ) ; } setDirty ( false ) ; }
fill background with color
