blob: 8d8d5ba8c5d41f7b96ec99642f32b7e287e0cf8b (
plain)
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
35
36
37
38
39
40
41
42
43
44
|
package bezier;
import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.JColorChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
* Panel for inputting colors.
*/
public class ColorInputPanel extends JPanel {
private static final long serialVersionUID = 5201595672794938745L;
/**
* The color picker being used.
*/
public final JColorChooser picker;
/**
* Create a color picker.
* @param label The label for the color.
*/
public ColorInputPanel(String label) {
this(Color.WHITE, label);
}
/**
* Create a color picker.
* @param init The initial color to use.
* @param label The label for the color.
*/
public ColorInputPanel(Color init, String label) {
picker = new JColorChooser(init);
setLayout(new BorderLayout());
JLabel lab = new JLabel(label);
add(lab, BorderLayout.LINE_START);
add(picker, BorderLayout.CENTER);
}
}
|