1 |
/* DefaultHSBChooserPanel.java -- |
/* DefaultHSBChooserPanel.java -- |
2 |
Copyright (C) 2004 Free Software Foundation, Inc. |
Copyright (C) 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
70 |
*/ |
*/ |
71 |
class DefaultHSBChooserPanel extends AbstractColorChooserPanel |
class DefaultHSBChooserPanel extends AbstractColorChooserPanel |
72 |
{ |
{ |
73 |
/** The gradient image displayed. */ |
/** The gradient image displayed. |
74 |
private transient Image gradientImage; |
* This is package-private to avoid an accessor method. */ |
75 |
|
transient Image gradientImage; |
76 |
|
|
77 |
/** The Panel that holds the gradient image. */ |
/** The Panel that holds the gradient image. */ |
78 |
private transient JPanel gradientPanel; |
private transient JPanel gradientPanel; |
79 |
|
|
80 |
/** The track gradient image. */ |
/** The track gradient image. |
81 |
private transient Image trackImage; |
* This is package-private to avoid an accessor method. */ |
82 |
|
transient Image trackImage; |
83 |
|
|
84 |
/** The panel that holds the track. */ |
/** The panel that holds the track. */ |
85 |
private transient JPanel trackPanel; |
private transient JPanel trackPanel; |
86 |
|
|
87 |
/** The slider for the locked HSB value. */ |
/** The slider for the locked HSB value. |
88 |
private transient JSlider slider; |
* This is package-private to avoid an accessor method. */ |
89 |
|
transient JSlider slider; |
90 |
/** The RadioButton that controls the Hue. */ |
|
91 |
private transient JRadioButton hRadio; |
/** The RadioButton that controls the Hue. |
92 |
|
* This is package-private to avoid an accessor method. */ |
93 |
/** The RadioButton that controls the Saturation. */ |
transient JRadioButton hRadio; |
94 |
private transient JRadioButton sRadio; |
|
95 |
|
/** The RadioButton that controls the Saturation. |
96 |
/** The RadioButton that controls the Brightness. */ |
* This is package-private to avoid an accessor method. */ |
97 |
private transient JRadioButton bRadio; |
transient JRadioButton sRadio; |
98 |
|
|
99 |
/** The JSpinner that controls the Hue. */ |
/** The RadioButton that controls the Brightness. |
100 |
private transient JSpinner hSpinner; |
* This is package-private to avoid an accessor method. */ |
101 |
|
transient JRadioButton bRadio; |
102 |
/** The JSpinner that controls the Saturation. */ |
|
103 |
private transient JSpinner sSpinner; |
/** The JSpinner that controls the Hue. |
104 |
|
* This is package-private to avoid an accessor method. */ |
105 |
/** The JSpinner that controls the Brightness. */ |
transient JSpinner hSpinner; |
106 |
private transient JSpinner bSpinner; |
|
107 |
|
/** The JSpinner that controls the Saturation. |
108 |
|
* This is package-private to avoid an accessor method. */ |
109 |
|
transient JSpinner sSpinner; |
110 |
|
|
111 |
|
/** The JSpinner that controls the Brightness. |
112 |
|
* This is package-private to avoid an accessor method. */ |
113 |
|
transient JSpinner bSpinner; |
114 |
|
|
115 |
/** The default width of the gradient image. */ |
/** The default width of the gradient image. */ |
116 |
private static final int imgWidth = 200; |
private static final int imgWidth = 200; |
141 |
/** The JLabel that displays the value of Blue. */ |
/** The JLabel that displays the value of Blue. */ |
142 |
private transient JLabel bFull; |
private transient JLabel bFull; |
143 |
|
|
144 |
/** The point that is displayed in the gradient image. */ |
/** The point that is displayed in the gradient image. |
145 |
private transient Point gradientPoint = new Point(); |
* Package-private to avoid an accessor method. |
146 |
|
*/ |
147 |
|
transient Point gradientPoint = new Point(); |
148 |
|
|
149 |
/** |
/** |
150 |
* This indicates that the change to the slider or point is triggered |
* This indicates that the change to the slider or point is triggered |
151 |
* internally. |
* internally. |
152 |
|
* This is package-private to avoid an accessor method. |
153 |
*/ |
*/ |
154 |
private transient boolean internalChange = false; |
transient boolean internalChange = false; |
155 |
|
|
156 |
/** This indicates that the change to the spinner is triggered internally. */ |
/** This indicates that the change to the spinner is triggered |
157 |
private transient boolean spinnerTrigger = false; |
* internally. |
158 |
|
* This is package-private to avoid an accessor method. */ |
159 |
|
transient boolean spinnerTrigger = false; |
160 |
|
|
161 |
/** This int identifies which spinner is currently locked. */ |
/** This int identifies which spinner is currently locked. |
162 |
private transient int locked = -1; |
* This is package-private to avoid an accessor method. */ |
163 |
|
transient int locked = -1; |
164 |
|
|
165 |
/** This value indicates that the Hue spinner is locked. */ |
/** This value indicates that the Hue spinner is locked. */ |
166 |
static final int HLOCKED = 0; |
static final int HLOCKED = 0; |
174 |
/** |
/** |
175 |
* This method indicates that the mouse event is in the process of being |
* This method indicates that the mouse event is in the process of being |
176 |
* handled. |
* handled. |
177 |
|
* This is package-private to avoid an accessor method. |
178 |
*/ |
*/ |
179 |
private transient boolean handlingMouse; |
transient boolean handlingMouse; |
180 |
|
|
181 |
/** |
/** |
182 |
* This helper class handles mouse events on the gradient image. |
* This helper class handles mouse events on the gradient image. |
732 |
/** |
/** |
733 |
* This method calls the appropriate method to update the gradient image |
* This method calls the appropriate method to update the gradient image |
734 |
* depending on which HSB value is constant. |
* depending on which HSB value is constant. |
735 |
|
* This is package-private to avoid an accessor method. |
736 |
*/ |
*/ |
737 |
private void updateImage() |
void updateImage() |
738 |
{ |
{ |
739 |
switch (locked) |
switch (locked) |
740 |
{ |
{ |
767 |
/** |
/** |
768 |
* This method updates the slider in response to making a different HSB |
* This method updates the slider in response to making a different HSB |
769 |
* property the constant. |
* property the constant. |
770 |
|
* This is package-private to avoid an accessor method. |
771 |
*/ |
*/ |
772 |
private void updateSlider() |
void updateSlider() |
773 |
{ |
{ |
774 |
if (slider == null) |
if (slider == null) |
775 |
return; |
return; |
797 |
/** |
/** |
798 |
* This method updates the track gradient image depending on which HSB |
* This method updates the track gradient image depending on which HSB |
799 |
* property is constant. |
* property is constant. |
800 |
|
* This is package-private to avoid an accessor method. |
801 |
*/ |
*/ |
802 |
private void updateTrack() |
void updateTrack() |
803 |
{ |
{ |
804 |
switch (locked) |
switch (locked) |
805 |
{ |
{ |