001    /*
002     * Copyright (c) 2005 Einar Pehrson <einar@pehrson.nu>.
003     *
004     * This file is part of
005     * CleanSheets - a spreadsheet application for the Java platform.
006     *
007     * CleanSheets is free software; you can redistribute it and/or modify
008     * it under the terms of the GNU General Public License as published by
009     * the Free Software Foundation; either version 2 of the License, or
010     * (at your option) any later version.
011     *
012     * CleanSheets is distributed in the hope that it will be useful,
013     * but WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015     * GNU General Public License for more details.
016     *
017     * You should have received a copy of the GNU General Public License
018     * along with CleanSheets; if not, write to the Free Software
019     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
020     */
021    package csheets.ui;
022    
023    import java.awt.Component;
024    import java.awt.Graphics;
025    
026    import javax.swing.Icon;
027    
028    /**
029     * A blank icon used to indent menu items.
030     * @author Einar Pehrson
031     */
032    public final class BlankIcon implements Icon {
033    
034            /** The height of the icon */
035            private int width;
036    
037            /** The width of the icon */
038            private int height;
039    
040            /**
041             * Creates a new blank icon with the given size.
042             * @param size the size of the icon (used as width and height)
043             */
044            public BlankIcon(int size) {
045                    this(size, size);
046            }
047    
048            /**
049             * Creates a new blank icon with the given width and height.
050             * @param width the width of the icon
051             * @param height the height of the icon
052             */
053            public BlankIcon(int width, int height) {
054                    this.width = width;
055                    this.height = height;
056            }
057    
058            /**
059             * Returns the width of the icon.
060             * @return the width of the icon.
061             */
062            public int getIconWidth() {
063                    return width;
064            }
065    
066            /**
067             * Returns the height of the icon.
068             * @return the height of the icon.
069             */
070            public int getIconHeight() {
071                    return height;
072            }
073    
074            /**
075             * Does nothing.
076             */
077            public void paintIcon(Component c, Graphics g, int x, int y) {}
078    }