001    package breakout;
002    
003    import java.awt.*;
004    
005    /**
006     * A Wall is an unkillable component used to edge in the World and
007     * prevent balls from escaping.
008     *
009     * @see breakout.World
010     *
011     * @author benmv@olin.edu
012     * @version <tt>$Id: Wall.java,v 1.2 2004/03/26 20:39:33 gus Exp $</tt>
013     */
014    public class Wall extends DefaultBreakoutComponent {
015        public Wall(Point location, Dimension size, World w) {
016            super(location,size,w);
017        }
018        
019        /**
020         * overridden to prevent Walls from getting killed.
021         */
022        public void kill() {
023            // nothing to do.. walls don't die
024        }
025        
026        /**
027         * Walls render as white rectangles of the appropriate size
028         *
029         * @param g Graphics used to render Wall.
030         */
031        public void paint(Graphics g) {
032            g.setColor(Color.white);
033            Dimension size = getSize();
034            g.fillRect(0,0,size.width,size.height);
035        }
036        
037        /**
038         * Walls do nothing when struck.
039         *
040         * @param striker BreakoutComponent rebounding off wall
041         */
042        public void hitBy(BreakoutComponent striker) {
043        }
044    }
045