|
|
@ -10,9 +10,7 @@ import java.awt.Graphics; |
|
|
|
import java.awt.GridLayout; |
|
|
|
import java.awt.GridLayout; |
|
|
|
import java.awt.Image; |
|
|
|
import java.awt.Image; |
|
|
|
import java.awt.Point; |
|
|
|
import java.awt.Point; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.*; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
|
|
|
import java.awt.event.MouseMotionListener; |
|
|
|
|
|
|
|
import java.awt.image.MemoryImageSource; |
|
|
|
import java.awt.image.MemoryImageSource; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
import java.util.regex.Pattern; |
|
|
@ -21,7 +19,6 @@ import javax.swing.ButtonGroup; |
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.JColorChooser; |
|
|
|
import javax.swing.JColorChooser; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JSlider; |
|
|
|
|
|
|
|
import javax.swing.SpinnerNumberModel; |
|
|
|
import javax.swing.SpinnerNumberModel; |
|
|
|
import javax.swing.SwingConstants; |
|
|
|
import javax.swing.SwingConstants; |
|
|
|
import javax.swing.colorchooser.AbstractColorChooserPanel; |
|
|
|
import javax.swing.colorchooser.AbstractColorChooserPanel; |
|
|
@ -32,6 +29,7 @@ import javax.swing.event.DocumentListener; |
|
|
|
import javax.swing.text.BadLocationException; |
|
|
|
import javax.swing.text.BadLocationException; |
|
|
|
import javax.swing.text.Document; |
|
|
|
import javax.swing.text.Document; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ibutton.UIRadioButton; |
|
|
|
import com.fr.design.gui.ibutton.UIRadioButton; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.islider.UISlider; |
|
|
|
import com.fr.design.gui.islider.UISlider; |
|
|
@ -42,72 +40,113 @@ import com.fr.general.Inter; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 颜色选择器自定义面板 |
|
|
|
* 颜色选择器自定义面板 |
|
|
|
* @author focus |
|
|
|
|
|
|
|
* |
|
|
|
* |
|
|
|
|
|
|
|
* @author focus |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelectable { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* The gradient image displayed. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
/** The gradient image displayed. */ |
|
|
|
|
|
|
|
private transient Image gradientImage; |
|
|
|
private transient Image gradientImage; |
|
|
|
|
|
|
|
|
|
|
|
/** The Panel that holds the gradient image. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The Panel that holds the gradient image. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient JPanel gradientPanel; |
|
|
|
private transient JPanel gradientPanel; |
|
|
|
|
|
|
|
|
|
|
|
/** The track gradient image. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The track gradient image. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient Image trackImage; |
|
|
|
private transient Image trackImage; |
|
|
|
|
|
|
|
|
|
|
|
/** The panel that holds the track. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The panel that holds the track. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient JPanel trackPanel; |
|
|
|
private transient JPanel trackPanel; |
|
|
|
|
|
|
|
|
|
|
|
/** The slider for the locked HSB value. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The slider for the locked HSB value. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient UISlider slider; |
|
|
|
private transient UISlider slider; |
|
|
|
|
|
|
|
|
|
|
|
/** The RadioButton that controls the Hue. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The RadioButton that controls the Hue. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient UIRadioButton hRadio; |
|
|
|
private transient UIRadioButton hRadio; |
|
|
|
|
|
|
|
|
|
|
|
/** The RadioButton that controls the Saturation. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The RadioButton that controls the Saturation. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient UIRadioButton sRadio; |
|
|
|
private transient UIRadioButton sRadio; |
|
|
|
|
|
|
|
|
|
|
|
/** The RadioButton that controls the Brightness. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The RadioButton that controls the Brightness. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient UIRadioButton bRadio; |
|
|
|
private transient UIRadioButton bRadio; |
|
|
|
|
|
|
|
|
|
|
|
/** The UIBasicSpinner that controls the Hue. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The UIBasicSpinner that controls the Hue. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient UIBasicSpinner hSpinner; |
|
|
|
private transient UIBasicSpinner hSpinner; |
|
|
|
|
|
|
|
|
|
|
|
/** The UIBasicSpinner that controls the Saturation. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The UIBasicSpinner that controls the Saturation. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient UIBasicSpinner sSpinner; |
|
|
|
private transient UIBasicSpinner sSpinner; |
|
|
|
|
|
|
|
|
|
|
|
/** The UIBasicSpinner that controls the Brightness. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The UIBasicSpinner that controls the Brightness. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient UIBasicSpinner bSpinner; |
|
|
|
private transient UIBasicSpinner bSpinner; |
|
|
|
|
|
|
|
|
|
|
|
/** The UIBasicSpinner that controls the Red. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The UIBasicSpinner that controls the Red. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient UIBasicSpinner rSpinner; |
|
|
|
private transient UIBasicSpinner rSpinner; |
|
|
|
|
|
|
|
|
|
|
|
/** The UIBasicSpinner that controls the Green. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The UIBasicSpinner that controls the Green. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient UIBasicSpinner gSpinner; |
|
|
|
private transient UIBasicSpinner gSpinner; |
|
|
|
|
|
|
|
|
|
|
|
/** The UIBasicSpinner that controls the Blue. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The UIBasicSpinner that controls the Blue. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient UIBasicSpinner bbSpinner; |
|
|
|
private transient UIBasicSpinner bbSpinner; |
|
|
|
|
|
|
|
|
|
|
|
private transient UITextField field; |
|
|
|
private transient UITextField field; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// private transient PickColorButton pickColorButton;
|
|
|
|
|
|
|
|
|
|
|
|
/** The default width of the gradient image. */ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* The default width of the gradient image. |
|
|
|
|
|
|
|
*/ |
|
|
|
private static final int IMG_WIDTH = 200; |
|
|
|
private static final int IMG_WIDTH = 200; |
|
|
|
|
|
|
|
|
|
|
|
/** The default height of the gradient image. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The default height of the gradient image. |
|
|
|
|
|
|
|
*/ |
|
|
|
private static final int IMG_HEIGHT = 205; |
|
|
|
private static final int IMG_HEIGHT = 205; |
|
|
|
|
|
|
|
|
|
|
|
/** The default width of the track gradient. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The default width of the track gradient. |
|
|
|
|
|
|
|
*/ |
|
|
|
private static final int TRACK_WIDTH = 20; |
|
|
|
private static final int TRACK_WIDTH = 20; |
|
|
|
|
|
|
|
|
|
|
|
/** The UILabel for Red. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The UILabel for Red. |
|
|
|
|
|
|
|
*/ |
|
|
|
private static final UILabel R = new UILabel("R"); |
|
|
|
private static final UILabel R = new UILabel("R"); |
|
|
|
|
|
|
|
|
|
|
|
/** The UILabel for Green. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The UILabel for Green. |
|
|
|
|
|
|
|
*/ |
|
|
|
private static final UILabel G = new UILabel("G"); |
|
|
|
private static final UILabel G = new UILabel("G"); |
|
|
|
|
|
|
|
|
|
|
|
/** The UILabel for Blue. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The UILabel for Blue. |
|
|
|
|
|
|
|
*/ |
|
|
|
private static final UILabel B = new UILabel("B"); |
|
|
|
private static final UILabel B = new UILabel("B"); |
|
|
|
|
|
|
|
|
|
|
|
private static final int H_MAX = 365; |
|
|
|
private static final int H_MAX = 365; |
|
|
@ -131,7 +170,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
private ImageRGBScrollListener rgbScroll = new ImageRGBScrollListener(); |
|
|
|
private ImageRGBScrollListener rgbScroll = new ImageRGBScrollListener(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** The point that is displayed in the gradient image. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* The point that is displayed in the gradient image. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient Point gradientPoint = new Point(); |
|
|
|
private transient Point gradientPoint = new Point(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -140,19 +181,29 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private transient boolean internalChange = false; |
|
|
|
private transient boolean internalChange = false; |
|
|
|
|
|
|
|
|
|
|
|
/** This indicates that the change to the spinner is triggered internally. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* This indicates that the change to the spinner is triggered internally. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient boolean spinnerTrigger = false; |
|
|
|
private transient boolean spinnerTrigger = false; |
|
|
|
|
|
|
|
|
|
|
|
/** This int identifies which spinner is currently locked. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* This int identifies which spinner is currently locked. |
|
|
|
|
|
|
|
*/ |
|
|
|
private transient int locked = -1; |
|
|
|
private transient int locked = -1; |
|
|
|
|
|
|
|
|
|
|
|
/** This value indicates that the Hue spinner is locked. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* This value indicates that the Hue spinner is locked. |
|
|
|
|
|
|
|
*/ |
|
|
|
static final int HLOCKED = 0; |
|
|
|
static final int HLOCKED = 0; |
|
|
|
|
|
|
|
|
|
|
|
/** This value indicates that the Saturation spinner is locked. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* This value indicates that the Saturation spinner is locked. |
|
|
|
|
|
|
|
*/ |
|
|
|
static final int SLOCKED = 1; |
|
|
|
static final int SLOCKED = 1; |
|
|
|
|
|
|
|
|
|
|
|
/** This value indicates that the Brightness spinner is locked. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* This value indicates that the Brightness spinner is locked. |
|
|
|
|
|
|
|
*/ |
|
|
|
static final int BLOCKED = 2; |
|
|
|
static final int BLOCKED = 2; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -162,12 +213,13 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
private transient boolean handlingMouse; |
|
|
|
private transient boolean handlingMouse; |
|
|
|
|
|
|
|
|
|
|
|
// 文本监听器,监听十六进制文本输入
|
|
|
|
// 文本监听器,监听十六进制文本输入
|
|
|
|
class TextDocumentListener implements DocumentListener{ |
|
|
|
class TextDocumentListener implements DocumentListener { |
|
|
|
|
|
|
|
|
|
|
|
// 十六进制颜色验证的正则表达式
|
|
|
|
// 十六进制颜色验证的正则表达式
|
|
|
|
private static final String HEX_PATTERN = "([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"; |
|
|
|
private static final String HEX_PATTERN = "([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"; |
|
|
|
private Pattern pattern; |
|
|
|
private Pattern pattern; |
|
|
|
private Matcher matcher; |
|
|
|
private Matcher matcher; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
Document doc = e.getDocument(); |
|
|
|
Document doc = e.getDocument(); |
|
|
@ -185,12 +237,12 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void updateColorForHex(Document doc){ |
|
|
|
private void updateColorForHex(Document doc) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
String str = doc.getText(0, doc.getLength()); |
|
|
|
String str = doc.getText(0, doc.getLength()); |
|
|
|
pattern = Pattern.compile(HEX_PATTERN); |
|
|
|
pattern = Pattern.compile(HEX_PATTERN); |
|
|
|
matcher = pattern.matcher(str); |
|
|
|
matcher = pattern.matcher(str); |
|
|
|
if(matcher.matches()){ |
|
|
|
if (matcher.matches()) { |
|
|
|
Color color = new Color(Integer.parseInt(str, 16)); |
|
|
|
Color color = new Color(Integer.parseInt(str, 16)); |
|
|
|
CustomChooserPanel.this.getColorSelectionModel().setSelectedColor(color); |
|
|
|
CustomChooserPanel.this.getColorSelectionModel().setSelectedColor(color); |
|
|
|
} |
|
|
|
} |
|
|
@ -205,16 +257,14 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* This helper class handles mouse events on the gradient image. |
|
|
|
* This helper class handles mouse events on the gradient image. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class MainGradientMouseListener extends MouseAdapter |
|
|
|
class MainGradientMouseListener extends MouseAdapter |
|
|
|
implements MouseMotionListener |
|
|
|
implements MouseMotionListener { |
|
|
|
{ |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* This method is called when the mouse is pressed over the gradient |
|
|
|
* This method is called when the mouse is pressed over the gradient |
|
|
|
* image. The JColorChooser is then updated with new HSB values. |
|
|
|
* image. The JColorChooser is then updated with new HSB values. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param e The MouseEvent. |
|
|
|
* @param e The MouseEvent. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void mousePressed(MouseEvent e) |
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
{ |
|
|
|
|
|
|
|
gradientPoint = e.getPoint(); |
|
|
|
gradientPoint = e.getPoint(); |
|
|
|
update(e.getPoint()); |
|
|
|
update(e.getPoint()); |
|
|
|
} |
|
|
|
} |
|
|
@ -225,10 +275,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* |
|
|
|
* |
|
|
|
* @param e The MouseEvent. |
|
|
|
* @param e The MouseEvent. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void mouseDragged(MouseEvent e) |
|
|
|
public void mouseDragged(MouseEvent e) { |
|
|
|
{ |
|
|
|
|
|
|
|
Point p = e.getPoint(); |
|
|
|
Point p = e.getPoint(); |
|
|
|
if (isMouseOutOfImage(p)){ |
|
|
|
if (isMouseOutOfImage(p)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -236,7 +285,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
update(p); |
|
|
|
update(p); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isMouseOutOfImage(Point p){ |
|
|
|
private boolean isMouseOutOfImage(Point p) { |
|
|
|
return (p.x < 0 || p.y < 0 || p.y > IMG_HEIGHT || p.x > IMG_WIDTH); |
|
|
|
return (p.x < 0 || p.y < 0 || p.y > IMG_HEIGHT || p.x > IMG_WIDTH); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -245,8 +294,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* |
|
|
|
* |
|
|
|
* @param e The MouseEvent. |
|
|
|
* @param e The MouseEvent. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void mouseMoved(MouseEvent e) |
|
|
|
public void mouseMoved(MouseEvent e) { |
|
|
|
{ |
|
|
|
|
|
|
|
// Do nothing.
|
|
|
|
// Do nothing.
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -255,14 +303,13 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* |
|
|
|
* |
|
|
|
* @param p The Point where the MouseEvent occurred. |
|
|
|
* @param p The Point where the MouseEvent occurred. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void update(Point p) |
|
|
|
private void update(Point p) { |
|
|
|
{ |
|
|
|
|
|
|
|
handlingMouse = true; |
|
|
|
handlingMouse = true; |
|
|
|
if (hSpinner.isEnabled()){ |
|
|
|
if (hSpinner.isEnabled()) { |
|
|
|
updateH(p); |
|
|
|
updateH(p); |
|
|
|
}else if (sSpinner.isEnabled()){ |
|
|
|
} else if (sSpinner.isEnabled()) { |
|
|
|
updateS(p); |
|
|
|
updateS(p); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
updateB(p); |
|
|
|
updateB(p); |
|
|
|
} |
|
|
|
} |
|
|
|
handlingMouse = false; |
|
|
|
handlingMouse = false; |
|
|
@ -273,8 +320,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* |
|
|
|
* |
|
|
|
* @param p The point where the MouseEvent occurred. |
|
|
|
* @param p The point where the MouseEvent occurred. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateH(Point p) |
|
|
|
private void updateH(Point p) { |
|
|
|
{ |
|
|
|
|
|
|
|
float s = (IMG_WIDTH - p.x * 1f) / IMG_WIDTH; |
|
|
|
float s = (IMG_WIDTH - p.x * 1f) / IMG_WIDTH; |
|
|
|
float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; |
|
|
|
float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; |
|
|
|
|
|
|
|
|
|
|
@ -292,8 +338,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* |
|
|
|
* |
|
|
|
* @param p The point where the MouseEvent occurred. |
|
|
|
* @param p The point where the MouseEvent occurred. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateS(Point p) |
|
|
|
private void updateS(Point p) { |
|
|
|
{ |
|
|
|
|
|
|
|
float h = p.x * 1f / IMG_WIDTH; |
|
|
|
float h = p.x * 1f / IMG_WIDTH; |
|
|
|
float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; |
|
|
|
float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; |
|
|
|
|
|
|
|
|
|
|
@ -310,8 +355,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* |
|
|
|
* |
|
|
|
* @param p The point where the MouseEvent occurred. |
|
|
|
* @param p The point where the MouseEvent occurred. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateB(Point p) |
|
|
|
private void updateB(Point p) { |
|
|
|
{ |
|
|
|
|
|
|
|
float h = p.x * 1f / IMG_WIDTH; |
|
|
|
float h = p.x * 1f / IMG_WIDTH; |
|
|
|
float s = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; |
|
|
|
float s = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; |
|
|
|
|
|
|
|
|
|
|
@ -327,25 +371,22 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
/** |
|
|
|
/** |
|
|
|
* This method listens for slider value changes. |
|
|
|
* This method listens for slider value changes. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class SliderChangeListener implements ChangeListener |
|
|
|
class SliderChangeListener implements ChangeListener { |
|
|
|
{ |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* This method is called when the slider value changes. It should change |
|
|
|
* This method is called when the slider value changes. It should change |
|
|
|
* the color of the JColorChooser. |
|
|
|
* the color of the JColorChooser. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param e The ChangeEvent. |
|
|
|
* @param e The ChangeEvent. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void stateChanged(ChangeEvent e) |
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
{ |
|
|
|
if (internalChange) { |
|
|
|
if (internalChange){ |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer value = new Integer(slider.getValue()); |
|
|
|
Integer value = new Integer(slider.getValue()); |
|
|
|
|
|
|
|
|
|
|
|
switch (locked) |
|
|
|
switch (locked) { |
|
|
|
{ |
|
|
|
|
|
|
|
case HLOCKED: |
|
|
|
case HLOCKED: |
|
|
|
hSpinner.setValue(value); |
|
|
|
hSpinner.setValue(value); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -364,29 +405,22 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* This helper class determines the active UIBasicSpinner. |
|
|
|
* This helper class determines the active UIBasicSpinner. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class RadioStateListener extends MouseAdapter |
|
|
|
class RadioStateListener extends MouseAdapter |
|
|
|
implements MouseMotionListener |
|
|
|
implements MouseMotionListener { |
|
|
|
{ |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* This method is called when there is a new UIRadioButton that was |
|
|
|
* This method is called when there is a new UIRadioButton that was |
|
|
|
* selected. As a result, it should activate the associated UIBasicSpinner. |
|
|
|
* selected. As a result, it should activate the associated UIBasicSpinner. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param e The ChangeEvent. |
|
|
|
* @param e The ChangeEvent. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void mousePressed(MouseEvent e) |
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
{ |
|
|
|
|
|
|
|
UIBasicSpinner change; |
|
|
|
UIBasicSpinner change; |
|
|
|
if (e.getSource() == hRadio) |
|
|
|
if (e.getSource() == hRadio) { |
|
|
|
{ |
|
|
|
|
|
|
|
locked = HLOCKED; |
|
|
|
locked = HLOCKED; |
|
|
|
change = hSpinner; |
|
|
|
change = hSpinner; |
|
|
|
} |
|
|
|
} else if (e.getSource() == sRadio) { |
|
|
|
else if (e.getSource() == sRadio) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
locked = SLOCKED; |
|
|
|
locked = SLOCKED; |
|
|
|
change = sSpinner; |
|
|
|
change = sSpinner; |
|
|
|
} |
|
|
|
} else { |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
locked = BLOCKED; |
|
|
|
locked = BLOCKED; |
|
|
|
change = bSpinner; |
|
|
|
change = bSpinner; |
|
|
|
} |
|
|
|
} |
|
|
@ -406,17 +440,15 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
/** |
|
|
|
/** |
|
|
|
* hsl 监听 |
|
|
|
* hsl 监听 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class ImageScrollListener implements ChangeListener |
|
|
|
class ImageScrollListener implements ChangeListener { |
|
|
|
{ |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* This method is called whenever one of the UIBasicSpinner values change. The |
|
|
|
* This method is called whenever one of the UIBasicSpinner values change. The |
|
|
|
* JColorChooser should be updated with the new HSB values. |
|
|
|
* JColorChooser should be updated with the new HSB values. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param e The ChangeEvent. |
|
|
|
* @param e The ChangeEvent. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void stateChanged(ChangeEvent e) |
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
{ |
|
|
|
if (internalChange) { |
|
|
|
if (internalChange){ |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
updateImageAndTrack(); |
|
|
|
updateImageAndTrack(); |
|
|
@ -427,17 +459,15 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
/** |
|
|
|
/** |
|
|
|
* rgb 监听 |
|
|
|
* rgb 监听 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class ImageRGBScrollListener implements ChangeListener |
|
|
|
class ImageRGBScrollListener implements ChangeListener { |
|
|
|
{ |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* This method is called whenever one of the UIBasicSpinner values change. The |
|
|
|
* This method is called whenever one of the UIBasicSpinner values change. The |
|
|
|
* JColorChooser should be updated with the new HSB values. |
|
|
|
* JColorChooser should be updated with the new HSB values. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param e The ChangeEvent. |
|
|
|
* @param e The ChangeEvent. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void stateChanged(ChangeEvent e) |
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
{ |
|
|
|
if (internalChange) { |
|
|
|
if (internalChange){ |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -447,7 +477,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
int bb = (Integer) bbSpinner.getValue(); |
|
|
|
int bb = (Integer) bbSpinner.getValue(); |
|
|
|
|
|
|
|
|
|
|
|
spinnerTrigger = true; |
|
|
|
spinnerTrigger = true; |
|
|
|
getColorSelectionModel().setSelectedColor(new Color(r,g,bb)); |
|
|
|
getColorSelectionModel().setSelectedColor(new Color(r, g, bb)); |
|
|
|
spinnerTrigger = false; |
|
|
|
spinnerTrigger = false; |
|
|
|
|
|
|
|
|
|
|
|
updateChooser(); |
|
|
|
updateChooser(); |
|
|
@ -458,8 +488,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Creates a new DefaultHSBChooserPanel object. |
|
|
|
* Creates a new DefaultHSBChooserPanel object. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
CustomChooserPanel() |
|
|
|
CustomChooserPanel() { |
|
|
|
{ |
|
|
|
|
|
|
|
super(); |
|
|
|
super(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -469,8 +498,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* |
|
|
|
* |
|
|
|
* @return The name displayed in the JColorChooser tab. |
|
|
|
* @return The name displayed in the JColorChooser tab. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public String getDisplayName() |
|
|
|
public String getDisplayName() { |
|
|
|
{ |
|
|
|
|
|
|
|
return Inter.getLocText("FR-Designer_Custom"); |
|
|
|
return Inter.getLocText("FR-Designer_Custom"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -479,8 +507,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* UIBasicSpinners, the JSlider, and the gradient image point) with updated |
|
|
|
* UIBasicSpinners, the JSlider, and the gradient image point) with updated |
|
|
|
* values when the JColorChooser color value changes. |
|
|
|
* values when the JColorChooser color value changes. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void updateChooser() |
|
|
|
public void updateChooser() { |
|
|
|
{ |
|
|
|
|
|
|
|
Color c = getColorSelectionModel().getSelectedColor(); |
|
|
|
Color c = getColorSelectionModel().getSelectedColor(); |
|
|
|
float[] hsbVals = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), |
|
|
|
float[] hsbVals = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), |
|
|
|
null); |
|
|
|
null); |
|
|
@ -490,32 +517,29 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
|
|
|
|
|
|
|
|
internalChange = false; |
|
|
|
internalChange = false; |
|
|
|
|
|
|
|
|
|
|
|
if (! handlingMouse && slider != null && ! slider.getValueIsAdjusting()){ |
|
|
|
if (!handlingMouse && slider != null && !slider.getValueIsAdjusting()) { |
|
|
|
updateImage(); |
|
|
|
updateImage(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (! handlingMouse || locked != HLOCKED){ |
|
|
|
if (!handlingMouse || locked != HLOCKED) { |
|
|
|
updateTrack(); |
|
|
|
updateTrack(); |
|
|
|
} |
|
|
|
} |
|
|
|
updateTextFields(); |
|
|
|
updateTextFields(); |
|
|
|
updateHexFields(); |
|
|
|
updateHexFields(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void adjustHSLValue(float[] hsbVals){ |
|
|
|
private void adjustHSLValue(float[] hsbVals) { |
|
|
|
if (! spinnerTrigger) |
|
|
|
if (!spinnerTrigger) { |
|
|
|
{ |
|
|
|
|
|
|
|
hSpinner.setValue(new Integer((int) (hsbVals[0] * HSPINNER_VALUE))); |
|
|
|
hSpinner.setValue(new Integer((int) (hsbVals[0] * HSPINNER_VALUE))); |
|
|
|
sSpinner.setValue(new Integer((int) (hsbVals[1] * SSPINNER_VALUE))); |
|
|
|
sSpinner.setValue(new Integer((int) (hsbVals[1] * SSPINNER_VALUE))); |
|
|
|
bSpinner.setValue(new Integer((int) (hsbVals[2] * LSPINNER_VALUE))); |
|
|
|
bSpinner.setValue(new Integer((int) (hsbVals[2] * LSPINNER_VALUE))); |
|
|
|
} |
|
|
|
} |
|
|
|
switch (locked) |
|
|
|
switch (locked) { |
|
|
|
{ |
|
|
|
|
|
|
|
case HLOCKED: |
|
|
|
case HLOCKED: |
|
|
|
if (slider != null){ |
|
|
|
if (slider != null) { |
|
|
|
slider.setValue(((Number) hSpinner.getValue()).intValue()); |
|
|
|
slider.setValue(((Number) hSpinner.getValue()).intValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (! handlingMouse) |
|
|
|
if (!handlingMouse) { |
|
|
|
{ |
|
|
|
|
|
|
|
gradientPoint.x = (int) ((1 |
|
|
|
gradientPoint.x = (int) ((1 |
|
|
|
- ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_WIDTH); |
|
|
|
- ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_WIDTH); |
|
|
|
gradientPoint.y = (int) ((1 |
|
|
|
gradientPoint.y = (int) ((1 |
|
|
@ -523,22 +547,20 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case SLOCKED: |
|
|
|
case SLOCKED: |
|
|
|
if (slider != null){ |
|
|
|
if (slider != null) { |
|
|
|
slider.setValue(((Number) sSpinner.getValue()).intValue()); |
|
|
|
slider.setValue(((Number) sSpinner.getValue()).intValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (! handlingMouse) |
|
|
|
if (!handlingMouse) { |
|
|
|
{ |
|
|
|
|
|
|
|
gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH); |
|
|
|
gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH); |
|
|
|
gradientPoint.y = (int) ((1 |
|
|
|
gradientPoint.y = (int) ((1 |
|
|
|
- ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT); |
|
|
|
- ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case BLOCKED: |
|
|
|
case BLOCKED: |
|
|
|
if (slider != null){ |
|
|
|
if (slider != null) { |
|
|
|
slider.setValue(((Number) bSpinner.getValue()).intValue()); |
|
|
|
slider.setValue(((Number) bSpinner.getValue()).intValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (! handlingMouse) |
|
|
|
if (!handlingMouse) { |
|
|
|
{ |
|
|
|
|
|
|
|
gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH); |
|
|
|
gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH); |
|
|
|
gradientPoint.y = (int) ((1 |
|
|
|
gradientPoint.y = (int) ((1 |
|
|
|
- ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_HEIGHT); |
|
|
|
- ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_HEIGHT); |
|
|
@ -547,7 +569,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void updateImageAndTrack(){ |
|
|
|
private void updateImageAndTrack() { |
|
|
|
float h = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; |
|
|
|
float h = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; |
|
|
|
float s = ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE; |
|
|
|
float s = ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE; |
|
|
|
float b = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE; |
|
|
|
float b = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE; |
|
|
@ -556,8 +578,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
getColorSelectionModel().setSelectedColor(new Color(Color.HSBtoRGB(h, s, b))); |
|
|
|
getColorSelectionModel().setSelectedColor(new Color(Color.HSBtoRGB(h, s, b))); |
|
|
|
spinnerTrigger = false; |
|
|
|
spinnerTrigger = false; |
|
|
|
|
|
|
|
|
|
|
|
if (! handlingMouse && slider != null && ! slider.getValueIsAdjusting()) |
|
|
|
if (!handlingMouse && slider != null && !slider.getValueIsAdjusting()) { |
|
|
|
{ |
|
|
|
|
|
|
|
updateImage(); |
|
|
|
updateImage(); |
|
|
|
updateTrack(); |
|
|
|
updateTrack(); |
|
|
|
} |
|
|
|
} |
|
|
@ -569,8 +590,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
/** |
|
|
|
/** |
|
|
|
* This method builds the DefaultHSBChooserPanel. |
|
|
|
* This method builds the DefaultHSBChooserPanel. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected void buildChooser() |
|
|
|
protected void buildChooser() { |
|
|
|
{ |
|
|
|
|
|
|
|
setLayout(new BorderLayout()); |
|
|
|
setLayout(new BorderLayout()); |
|
|
|
add(buildRightPanel(), BorderLayout.EAST); |
|
|
|
add(buildRightPanel(), BorderLayout.EAST); |
|
|
|
JPanel container = new JPanel(); |
|
|
|
JPanel container = new JPanel(); |
|
|
@ -603,17 +623,14 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
repaint(); |
|
|
|
repaint(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel createGradientPanel(){ |
|
|
|
private JPanel createGradientPanel() { |
|
|
|
return new JPanel() |
|
|
|
return new JPanel() { |
|
|
|
{ |
|
|
|
public Dimension getPreferredSize() { |
|
|
|
public Dimension getPreferredSize() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return new Dimension(IMG_WIDTH, IMG_HEIGHT); |
|
|
|
return new Dimension(IMG_WIDTH, IMG_HEIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void paint(Graphics g) |
|
|
|
public void paint(Graphics g) { |
|
|
|
{ |
|
|
|
if (gradientImage != null) { |
|
|
|
if (gradientImage != null){ |
|
|
|
|
|
|
|
g.drawImage(gradientImage, 0, 0, this); |
|
|
|
g.drawImage(gradientImage, 0, 0, this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -625,17 +642,14 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel createTrackPanel(){ |
|
|
|
private JPanel createTrackPanel() { |
|
|
|
return new JPanel() |
|
|
|
return new JPanel() { |
|
|
|
{ |
|
|
|
public Dimension getPreferredSize() { |
|
|
|
public Dimension getPreferredSize() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return new Dimension(TRACK_WIDTH, IMG_HEIGHT); |
|
|
|
return new Dimension(TRACK_WIDTH, IMG_HEIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void paint(Graphics g) |
|
|
|
public void paint(Graphics g) { |
|
|
|
{ |
|
|
|
if (trackImage != null) { |
|
|
|
if (trackImage != null){ |
|
|
|
|
|
|
|
g.drawImage(trackImage, 0, 0, this); |
|
|
|
g.drawImage(trackImage, 0, 0, this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -648,8 +662,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* |
|
|
|
* |
|
|
|
* @param chooser The JColorChooser to remove this panel from. |
|
|
|
* @param chooser The JColorChooser to remove this panel from. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void uninstallChooserPanel(JColorChooser chooser) |
|
|
|
public void uninstallChooserPanel(JColorChooser chooser) { |
|
|
|
{ |
|
|
|
|
|
|
|
trackImage = null; |
|
|
|
trackImage = null; |
|
|
|
gradientImage = null; |
|
|
|
gradientImage = null; |
|
|
|
gradientPanel = null; |
|
|
|
gradientPanel = null; |
|
|
@ -673,8 +686,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* |
|
|
|
* |
|
|
|
* @return The right side panel. |
|
|
|
* @return The right side panel. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Container buildRightPanel() |
|
|
|
private Container buildRightPanel() { |
|
|
|
{ |
|
|
|
|
|
|
|
JPanel container = new JPanel(); |
|
|
|
JPanel container = new JPanel(); |
|
|
|
container.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
|
|
|
container.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
|
|
|
|
|
|
|
|
|
|
@ -682,30 +694,32 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
JPanel mainPanel = new JPanel(); |
|
|
|
JPanel mainPanel = new JPanel(); |
|
|
|
mainPanel.setLayout(new BorderLayout(0, 10)); |
|
|
|
mainPanel.setLayout(new BorderLayout(0, 10)); |
|
|
|
UILabel label = new UILabel(); |
|
|
|
UILabel label = new UILabel(); |
|
|
|
label.setSize(200,200); |
|
|
|
label.setSize(200, 200); |
|
|
|
container.add(label); |
|
|
|
container.add(label); |
|
|
|
container.add(mainPanel); |
|
|
|
container.add(mainPanel); |
|
|
|
|
|
|
|
|
|
|
|
// hsl和rgb面板
|
|
|
|
// hsl和rgb面板
|
|
|
|
JPanel hslAndRgbPanel = new JPanel(); |
|
|
|
JPanel hslAndRgbPanel = new JPanel(); |
|
|
|
hslAndRgbPanel.setLayout(new BorderLayout(0,16)); |
|
|
|
hslAndRgbPanel.setLayout(new BorderLayout(0, 16)); |
|
|
|
hslAndRgbPanel.add(initialHSLPanel(),BorderLayout.CENTER); |
|
|
|
hslAndRgbPanel.add(initialHSLPanel(), BorderLayout.CENTER); |
|
|
|
hslAndRgbPanel.add(initialRGBPanel(),BorderLayout.SOUTH); |
|
|
|
hslAndRgbPanel.add(initialRGBPanel(), BorderLayout.SOUTH); |
|
|
|
|
|
|
|
|
|
|
|
// 十六进制面板
|
|
|
|
// 十六进制面板
|
|
|
|
JPanel hexPanel = new JPanel(); |
|
|
|
JPanel hexPanel = new JPanel(); |
|
|
|
hexPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 8, 0)); |
|
|
|
hexPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 8, 0)); |
|
|
|
hexPanel.add(new UILabel("#")); |
|
|
|
hexPanel.add(new UILabel("#")); |
|
|
|
hexPanel.add(field); |
|
|
|
hexPanel.add(field); |
|
|
|
|
|
|
|
UIButton pickColorButton = PickColorButtonFactory.getPickColorButton(this, PickColorButtonFactory.IconType.ICON18, true); |
|
|
|
|
|
|
|
hexPanel.add(pickColorButton); |
|
|
|
|
|
|
|
|
|
|
|
mainPanel.add(hslAndRgbPanel,BorderLayout.CENTER); |
|
|
|
mainPanel.add(hslAndRgbPanel, BorderLayout.CENTER); |
|
|
|
mainPanel.add(hexPanel,BorderLayout.SOUTH); |
|
|
|
mainPanel.add(hexPanel, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
|
|
|
|
return container; |
|
|
|
return container; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//初始化HSL部分
|
|
|
|
//初始化HSL部分
|
|
|
|
private JPanel initialHSLPanel(){ |
|
|
|
private JPanel initialHSLPanel() { |
|
|
|
hRadio = new UIRadioButton("H"); |
|
|
|
hRadio = new UIRadioButton("H"); |
|
|
|
sRadio = new UIRadioButton("S"); |
|
|
|
sRadio = new UIRadioButton("S"); |
|
|
|
bRadio = new UIRadioButton("L"); |
|
|
|
bRadio = new UIRadioButton("L"); |
|
|
@ -734,7 +748,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
bSpinner.addChangeListener(scroll); |
|
|
|
bSpinner.addChangeListener(scroll); |
|
|
|
|
|
|
|
|
|
|
|
JPanel hslPanel = new JPanel(); |
|
|
|
JPanel hslPanel = new JPanel(); |
|
|
|
hslPanel.setLayout(new GridLayout(3,0,0,5)); |
|
|
|
hslPanel.setLayout(new GridLayout(3, 0, 0, 5)); |
|
|
|
|
|
|
|
|
|
|
|
JPanel hPanel = new JPanel(); |
|
|
|
JPanel hPanel = new JPanel(); |
|
|
|
hPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 0)); |
|
|
|
hPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 0)); |
|
|
@ -756,7 +770,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
return hslPanel; |
|
|
|
return hslPanel; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel initialRGBPanel(){ |
|
|
|
private JPanel initialRGBPanel() { |
|
|
|
// 初始化RGB部分
|
|
|
|
// 初始化RGB部分
|
|
|
|
rSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, 255, 1)); |
|
|
|
rSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, 255, 1)); |
|
|
|
gSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, 255, 1)); |
|
|
|
gSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, 255, 1)); |
|
|
@ -770,11 +784,11 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
|
|
|
|
|
|
|
|
TextDocumentListener listen = new TextDocumentListener(); |
|
|
|
TextDocumentListener listen = new TextDocumentListener(); |
|
|
|
field = new UITextField(); |
|
|
|
field = new UITextField(); |
|
|
|
field.setPreferredSize(new Dimension(70,18)); |
|
|
|
field.setPreferredSize(new Dimension(70, 18)); |
|
|
|
field.getDocument().addDocumentListener(listen); |
|
|
|
field.getDocument().addDocumentListener(listen); |
|
|
|
|
|
|
|
|
|
|
|
JPanel rgbPanel = new JPanel(); |
|
|
|
JPanel rgbPanel = new JPanel(); |
|
|
|
rgbPanel.setLayout(new GridLayout(3,0,0,5)); |
|
|
|
rgbPanel.setLayout(new GridLayout(3, 0, 0, 5)); |
|
|
|
|
|
|
|
|
|
|
|
JPanel rPanel = new JPanel(); |
|
|
|
JPanel rPanel = new JPanel(); |
|
|
|
rPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 0)); |
|
|
|
rPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 0)); |
|
|
@ -802,8 +816,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* |
|
|
|
* |
|
|
|
* @return The small display icon. |
|
|
|
* @return The small display icon. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Icon getSmallDisplayIcon() |
|
|
|
public Icon getSmallDisplayIcon() { |
|
|
|
{ |
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -812,8 +825,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* |
|
|
|
* |
|
|
|
* @return The large display icon. |
|
|
|
* @return The large display icon. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Icon getLargeDisplayIcon() |
|
|
|
public Icon getLargeDisplayIcon() { |
|
|
|
{ |
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -821,15 +833,13 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* This method updates the gradient image with a new one taking the Hue |
|
|
|
* This method updates the gradient image with a new one taking the Hue |
|
|
|
* value as the constant. |
|
|
|
* value as the constant. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateHLockImage() |
|
|
|
private void updateHLockImage() { |
|
|
|
{ |
|
|
|
|
|
|
|
int index = 0; |
|
|
|
int index = 0; |
|
|
|
int[] pix = new int[IMG_WIDTH * IMG_HEIGHT]; |
|
|
|
int[] pix = new int[IMG_WIDTH * IMG_HEIGHT]; |
|
|
|
float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; |
|
|
|
float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; |
|
|
|
|
|
|
|
|
|
|
|
for (int j = 0; j < IMG_HEIGHT; j++) |
|
|
|
for (int j = 0; j < IMG_HEIGHT; j++) { |
|
|
|
{ |
|
|
|
for (int i = 0; i < IMG_WIDTH; i++) { |
|
|
|
for (int i = 0; i < IMG_WIDTH; i++){ |
|
|
|
|
|
|
|
pix[index++] = Color.HSBtoRGB(hValue, (IMG_WIDTH - i * 1f) / IMG_WIDTH, |
|
|
|
pix[index++] = Color.HSBtoRGB(hValue, (IMG_WIDTH - i * 1f) / IMG_WIDTH, |
|
|
|
(IMG_HEIGHT - j * 1f) / IMG_HEIGHT) | (BINARY_FOR_EIGHT << TWENTY_FOUR); |
|
|
|
(IMG_HEIGHT - j * 1f) / IMG_HEIGHT) | (BINARY_FOR_EIGHT << TWENTY_FOUR); |
|
|
|
} |
|
|
|
} |
|
|
@ -843,14 +853,13 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* This method updates the gradient image with a new one taking the |
|
|
|
* This method updates the gradient image with a new one taking the |
|
|
|
* Brightness value as the constant. |
|
|
|
* Brightness value as the constant. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateBLockImage() |
|
|
|
private void updateBLockImage() { |
|
|
|
{ |
|
|
|
|
|
|
|
int[] pix = new int[IMG_WIDTH * IMG_HEIGHT]; |
|
|
|
int[] pix = new int[IMG_WIDTH * IMG_HEIGHT]; |
|
|
|
float bValue = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE; |
|
|
|
float bValue = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE; |
|
|
|
|
|
|
|
|
|
|
|
int index = 0; |
|
|
|
int index = 0; |
|
|
|
for (int j = 0; j < IMG_HEIGHT; j++){ |
|
|
|
for (int j = 0; j < IMG_HEIGHT; j++) { |
|
|
|
for (int i = 0; i < IMG_WIDTH; i++){ |
|
|
|
for (int i = 0; i < IMG_WIDTH; i++) { |
|
|
|
pix[index++] = Color.HSBtoRGB(i * 1f / IMG_WIDTH, |
|
|
|
pix[index++] = Color.HSBtoRGB(i * 1f / IMG_WIDTH, |
|
|
|
(IMG_HEIGHT - j * 1f) / IMG_HEIGHT, bValue) | (BINARY_FOR_EIGHT << TWENTY_FOUR); |
|
|
|
(IMG_HEIGHT - j * 1f) / IMG_HEIGHT, bValue) | (BINARY_FOR_EIGHT << TWENTY_FOUR); |
|
|
|
} |
|
|
|
} |
|
|
@ -864,16 +873,15 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* This method updates the gradient image with a new one taking the |
|
|
|
* This method updates the gradient image with a new one taking the |
|
|
|
* Saturation value as the constant. |
|
|
|
* Saturation value as the constant. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateSLockImage() |
|
|
|
private void updateSLockImage() { |
|
|
|
{ |
|
|
|
|
|
|
|
int[] pix = new int[IMG_WIDTH * IMG_HEIGHT]; |
|
|
|
int[] pix = new int[IMG_WIDTH * IMG_HEIGHT]; |
|
|
|
float sValue = ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE; |
|
|
|
float sValue = ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE; |
|
|
|
|
|
|
|
|
|
|
|
int index = 0; |
|
|
|
int index = 0; |
|
|
|
for (int j = 0; j < IMG_HEIGHT; j++){ |
|
|
|
for (int j = 0; j < IMG_HEIGHT; j++) { |
|
|
|
for (int i = 0; i < IMG_WIDTH; i++){ |
|
|
|
for (int i = 0; i < IMG_WIDTH; i++) { |
|
|
|
pix[index++] = Color.HSBtoRGB(i * 1f / IMG_WIDTH, sValue, |
|
|
|
pix[index++] = Color.HSBtoRGB(i * 1f / IMG_WIDTH, sValue, |
|
|
|
(IMG_HEIGHT - j * 1f) / IMG_HEIGHT)| (BINARY_FOR_EIGHT << TWENTY_FOUR); |
|
|
|
(IMG_HEIGHT - j * 1f) / IMG_HEIGHT) | (BINARY_FOR_EIGHT << TWENTY_FOUR); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -885,10 +893,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* This method calls the appropriate method to update the gradient image |
|
|
|
* This method calls the appropriate method to update the gradient image |
|
|
|
* depending on which HSB value is constant. |
|
|
|
* depending on which HSB value is constant. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateImage() |
|
|
|
private void updateImage() { |
|
|
|
{ |
|
|
|
switch (locked) { |
|
|
|
switch (locked) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case HLOCKED: |
|
|
|
case HLOCKED: |
|
|
|
updateHLockImage(); |
|
|
|
updateHLockImage(); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -904,8 +910,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
/** |
|
|
|
/** |
|
|
|
* This method updates the TextFields with the correct RGB values. |
|
|
|
* This method updates the TextFields with the correct RGB values. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateTextFields() |
|
|
|
private void updateTextFields() { |
|
|
|
{ |
|
|
|
|
|
|
|
int c = getColorSelectionModel().getSelectedColor().getRGB(); |
|
|
|
int c = getColorSelectionModel().getSelectedColor().getRGB(); |
|
|
|
|
|
|
|
|
|
|
|
removeRGBSpinnerChangeLisener(); |
|
|
|
removeRGBSpinnerChangeLisener(); |
|
|
@ -917,20 +922,19 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
repaint(); |
|
|
|
repaint(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void removeRGBSpinnerChangeLisener(){ |
|
|
|
private void removeRGBSpinnerChangeLisener() { |
|
|
|
rSpinner.removeChangeListener(rgbScroll); |
|
|
|
rSpinner.removeChangeListener(rgbScroll); |
|
|
|
gSpinner.removeChangeListener(rgbScroll); |
|
|
|
gSpinner.removeChangeListener(rgbScroll); |
|
|
|
bbSpinner.removeChangeListener(rgbScroll); |
|
|
|
bbSpinner.removeChangeListener(rgbScroll); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void addRGBSpinnerChangeLisener(){ |
|
|
|
private void addRGBSpinnerChangeLisener() { |
|
|
|
rSpinner.addChangeListener(rgbScroll); |
|
|
|
rSpinner.addChangeListener(rgbScroll); |
|
|
|
gSpinner.addChangeListener(rgbScroll); |
|
|
|
gSpinner.addChangeListener(rgbScroll); |
|
|
|
bbSpinner.addChangeListener(rgbScroll); |
|
|
|
bbSpinner.addChangeListener(rgbScroll); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void updateHexFields() |
|
|
|
private void updateHexFields() { |
|
|
|
{ |
|
|
|
|
|
|
|
Color color = getColorSelectionModel().getSelectedColor(); |
|
|
|
Color color = getColorSelectionModel().getSelectedColor(); |
|
|
|
|
|
|
|
|
|
|
|
String R = Integer.toHexString(color.getRed()); |
|
|
|
String R = Integer.toHexString(color.getRed()); |
|
|
@ -940,9 +944,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
String G = Integer.toHexString(color.getGreen()); |
|
|
|
String G = Integer.toHexString(color.getGreen()); |
|
|
|
G = G.length() < 2 ? ('0' + G) : G; |
|
|
|
G = G.length() < 2 ? ('0' + G) : G; |
|
|
|
|
|
|
|
|
|
|
|
try{ |
|
|
|
try { |
|
|
|
field.setText(R + G + B); |
|
|
|
field.setText(R + G + B); |
|
|
|
}catch(Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
// 因为有了DocumentListener的监听,导致setText()的时候报错但不影响使用
|
|
|
|
// 因为有了DocumentListener的监听,导致setText()的时候报错但不影响使用
|
|
|
|
// 所以只捕捉,不处理
|
|
|
|
// 所以只捕捉,不处理
|
|
|
|
} |
|
|
|
} |
|
|
@ -953,27 +957,23 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* This method updates the slider in response to making a different HSB |
|
|
|
* This method updates the slider in response to making a different HSB |
|
|
|
* property the constant. |
|
|
|
* property the constant. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateSlider() |
|
|
|
private void updateSlider() { |
|
|
|
{ |
|
|
|
if (slider == null) { |
|
|
|
if (slider == null){ |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
slider.setMinimum(0); |
|
|
|
slider.setMinimum(0); |
|
|
|
if (locked == HLOCKED) |
|
|
|
if (locked == HLOCKED) { |
|
|
|
{ |
|
|
|
|
|
|
|
internalChange = true; |
|
|
|
internalChange = true; |
|
|
|
slider.setValue(((Number) hSpinner.getValue()).intValue()); |
|
|
|
slider.setValue(((Number) hSpinner.getValue()).intValue()); |
|
|
|
slider.setMaximum(359); |
|
|
|
slider.setMaximum(359); |
|
|
|
internalChange = false; |
|
|
|
internalChange = false; |
|
|
|
slider.setInverted(true); |
|
|
|
slider.setInverted(true); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
slider.setInverted(false); |
|
|
|
slider.setInverted(false); |
|
|
|
if (locked == SLOCKED){ |
|
|
|
if (locked == SLOCKED) { |
|
|
|
slider.setValue(((Number) sSpinner.getValue()).intValue()); |
|
|
|
slider.setValue(((Number) sSpinner.getValue()).intValue()); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
slider.setValue(((Number) bSpinner.getValue()).intValue()); |
|
|
|
slider.setValue(((Number) bSpinner.getValue()).intValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
slider.setMaximum(100); |
|
|
|
slider.setMaximum(100); |
|
|
@ -986,10 +986,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* This method updates the track gradient image depending on which HSB |
|
|
|
* This method updates the track gradient image depending on which HSB |
|
|
|
* property is constant. |
|
|
|
* property is constant. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateTrack() |
|
|
|
private void updateTrack() { |
|
|
|
{ |
|
|
|
switch (locked) { |
|
|
|
switch (locked) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case HLOCKED: |
|
|
|
case HLOCKED: |
|
|
|
updateHTrack(); |
|
|
|
updateHTrack(); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -1006,13 +1004,12 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* This method updates the track gradient image if the Hue value is allowed |
|
|
|
* This method updates the track gradient image if the Hue value is allowed |
|
|
|
* to change (according to the UIRadioButtons). |
|
|
|
* to change (according to the UIRadioButtons). |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateHTrack() |
|
|
|
private void updateHTrack() { |
|
|
|
{ |
|
|
|
|
|
|
|
int trackIndex = 0; |
|
|
|
int trackIndex = 0; |
|
|
|
int[] trackPix = new int[TRACK_WIDTH * IMG_HEIGHT]; |
|
|
|
int[] trackPix = new int[TRACK_WIDTH * IMG_HEIGHT]; |
|
|
|
|
|
|
|
|
|
|
|
for (int j = 0; j < IMG_HEIGHT; j++){ |
|
|
|
for (int j = 0; j < IMG_HEIGHT; j++) { |
|
|
|
for (int i = 0; i < TRACK_WIDTH; i++){ |
|
|
|
for (int i = 0; i < TRACK_WIDTH; i++) { |
|
|
|
trackPix[trackIndex++] = Color.HSBtoRGB(j * 1f / IMG_HEIGHT, 1f, 1f) |
|
|
|
trackPix[trackIndex++] = Color.HSBtoRGB(j * 1f / IMG_HEIGHT, 1f, 1f) |
|
|
|
| (BINARY_FOR_EIGHT << TWENTY_FOUR); |
|
|
|
| (BINARY_FOR_EIGHT << TWENTY_FOUR); |
|
|
|
} |
|
|
|
} |
|
|
@ -1026,16 +1023,15 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* This method updates the track gradient image if the Saturation value is |
|
|
|
* This method updates the track gradient image if the Saturation value is |
|
|
|
* allowed to change (according to the UIRadioButtons). |
|
|
|
* allowed to change (according to the UIRadioButtons). |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateSTrack() |
|
|
|
private void updateSTrack() { |
|
|
|
{ |
|
|
|
|
|
|
|
int[] trackPix = new int[TRACK_WIDTH * IMG_HEIGHT]; |
|
|
|
int[] trackPix = new int[TRACK_WIDTH * IMG_HEIGHT]; |
|
|
|
|
|
|
|
|
|
|
|
float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; |
|
|
|
float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; |
|
|
|
float bValue = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE; |
|
|
|
float bValue = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE; |
|
|
|
|
|
|
|
|
|
|
|
int trackIndex = 0; |
|
|
|
int trackIndex = 0; |
|
|
|
for (int j = 0; j < IMG_HEIGHT; j++){ |
|
|
|
for (int j = 0; j < IMG_HEIGHT; j++) { |
|
|
|
for (int i = 0; i < TRACK_WIDTH; i++){ |
|
|
|
for (int i = 0; i < TRACK_WIDTH; i++) { |
|
|
|
trackPix[trackIndex++] = Color.HSBtoRGB(hValue, |
|
|
|
trackPix[trackIndex++] = Color.HSBtoRGB(hValue, |
|
|
|
(IMG_HEIGHT - j * 1f) / IMG_HEIGHT, |
|
|
|
(IMG_HEIGHT - j * 1f) / IMG_HEIGHT, |
|
|
|
bValue) | (BINARY_FOR_EIGHT << TWENTY_FOUR); |
|
|
|
bValue) | (BINARY_FOR_EIGHT << TWENTY_FOUR); |
|
|
@ -1050,16 +1046,15 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
* This method updates the track gradient image if the Brightness value is |
|
|
|
* This method updates the track gradient image if the Brightness value is |
|
|
|
* allowed to change (according to the UIRadioButtons). |
|
|
|
* allowed to change (according to the UIRadioButtons). |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateBTrack() |
|
|
|
private void updateBTrack() { |
|
|
|
{ |
|
|
|
|
|
|
|
int[] trackPix = new int[TRACK_WIDTH * IMG_HEIGHT]; |
|
|
|
int[] trackPix = new int[TRACK_WIDTH * IMG_HEIGHT]; |
|
|
|
|
|
|
|
|
|
|
|
float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; |
|
|
|
float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; |
|
|
|
float sValue = ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE; |
|
|
|
float sValue = ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE; |
|
|
|
|
|
|
|
|
|
|
|
int trackIndex = 0; |
|
|
|
int trackIndex = 0; |
|
|
|
for (int j = 0; j < IMG_HEIGHT; j++){ |
|
|
|
for (int j = 0; j < IMG_HEIGHT; j++) { |
|
|
|
for (int i = 0; i < TRACK_WIDTH; i++){ |
|
|
|
for (int i = 0; i < TRACK_WIDTH; i++) { |
|
|
|
trackPix[trackIndex++] = Color.HSBtoRGB(hValue, sValue, |
|
|
|
trackPix[trackIndex++] = Color.HSBtoRGB(hValue, sValue, |
|
|
|
(IMG_HEIGHT - j * 1f) / IMG_HEIGHT) | (BINARY_FOR_EIGHT << TWENTY_FOUR); |
|
|
|
(IMG_HEIGHT - j * 1f) / IMG_HEIGHT) | (BINARY_FOR_EIGHT << TWENTY_FOUR); |
|
|
|
} |
|
|
|
} |
|
|
@ -1069,4 +1064,15 @@ class CustomChooserPanel extends AbstractColorChooserPanel |
|
|
|
trackPix, 0, TRACK_WIDTH)); |
|
|
|
trackPix, 0, TRACK_WIDTH)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Color getColor() { |
|
|
|
|
|
|
|
return getColorSelectionModel().getSelectedColor(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setColor(Color color) { |
|
|
|
|
|
|
|
getColorSelectionModel().setSelectedColor(color); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void colorSetted(ColorCell cc) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |