Back to index

moin  1.9.0~rc2
Filler.java
Go to the documentation of this file.
00001 /*
00002  * @(#)Filler.java 5.1
00003  *
00004  */
00005 
00006 package CH.ifa.draw.util;
00007 
00008 import java.awt.*;
00009 
00015 public  class Filler
00016         extends Canvas {
00017 
00018     private int     fWidth;
00019     private int     fHeight;
00020     private Color   fBackground;
00021 
00022 
00023     public Filler(int width, int height) {
00024         this(width, height, null);
00025     }
00026 
00027     public Filler(int width, int height, Color background) {
00028         fWidth = width;
00029         fHeight = height;
00030         fBackground = background;
00031     }
00032 
00033     public Dimension getMinimumSize() {
00034         return new Dimension(fWidth, fHeight);
00035     }
00036 
00037     public Dimension getPreferredSize() {
00038         return getMinimumSize();
00039     }
00040 
00041     public Color getBackground() {
00042         if (fBackground != null)
00043             return fBackground;
00044         return super.getBackground();
00045     }
00046 }
00047