001    package org.shiftone.jrat.ui.util;
002    
003    
004    import org.shiftone.jrat.util.log.Logger;
005    
006    import javax.swing.*;
007    import java.awt.*;
008    
009    
010    /**
011     * Class DotIcon
012     *
013     * @author jeff@shiftone.org (Jeff Drost)
014     */
015    public class DotIcon implements Icon {
016    
017        private static final Logger LOG = Logger.getLogger(DotIcon.class);
018        private int size = 0;
019        private Color color = null;
020    
021        /**
022         * Constructor DotIcon
023         *
024         * @param size
025         * @param color
026         */
027        public DotIcon(int size, Color color) {
028            this.color = color;
029            this.size = size;
030        }
031    
032    
033        /**
034         * Method getIconHeight
035         */
036        public int getIconHeight() {
037            return size;
038        }
039    
040    
041        /**
042         * Method getIconWidth
043         */
044        public int getIconWidth() {
045            return size;
046        }
047    
048    
049        /**
050         * Method paintIcon
051         */
052        public void paintIcon(Component c, Graphics g, int x, int y) {
053    
054            g.setColor(Color.gray);
055            g.fillOval(x, y, size, size);
056            g.setColor(color);
057            g.fillOval(x + 1, y + 1, size - 2, size - 2);
058        }
059    }