File: ColourPatch.java

package info (click to toggle)
gpsprune 10-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,220 kB
  • ctags: 3,013
  • sloc: java: 22,662; sh: 23; makefile: 16; python: 15
file content (34 lines) | stat: -rw-r--r-- 646 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package tim.prune.gui;

import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JPanel;

import tim.prune.config.ColourUtils;

/**
 * Class to act as a colour patch to illustrate a chosen colour
 */
public class ColourPatch extends JPanel
{
	/**
	 * Constructor
	 */
	public ColourPatch(Color inColour)
	{
		Dimension size = new Dimension(80, 50);
		setMinimumSize(size);
		setPreferredSize(size);
		setColour(inColour);
	}

	/**
	 * Set the colour of the patch
	 * @param inColour Color to use
	 */
	public void setColour(Color inColour)
	{
		super.setBackground(inColour);
		setToolTipText(ColourUtils.makeHexCode(inColour));
	}
}