Guided tour updates
[debian/openrocket] / core / src / net / sf / openrocket / gui / components / ColorIcon.java
1 package net.sf.openrocket.gui.components;
2
3 import java.awt.Color;
4
5 import javax.swing.Icon;
6
7 /**
8  * An Icon that displays a specific color, suitable for drawing into a button.
9  * 
10  * @author Sampo Niskanen <sampo.niskanen@iki.fi>
11  */
12 public class ColorIcon implements Icon {
13         private final Color color;
14         
15         public ColorIcon(Color c) {
16                 this.color = c;
17         }
18         
19         @Override
20         public int getIconHeight() {
21                 return 15;
22         }
23         
24         @Override
25         public int getIconWidth() {
26                 return 25;
27         }
28         
29         @Override
30         public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y) {
31                 g.setColor(color);
32                 g.fill3DRect(x, y, getIconWidth(), getIconHeight(), false);
33         }
34         
35 }