changeset 606:f7585c3756ee

6552812: Add HSL tab to JColorChooser Reviewed-by: peterz, avu
author malenkov
date Fri, 18 Jul 2008 18:26:22 +0400
parents ccdfb79c9864
children fdbc0517be43
files src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties src/share/classes/javax/swing/colorchooser/ColorChooserComponentFactory.java src/share/classes/javax/swing/colorchooser/ColorChooserPanel.java src/share/classes/javax/swing/colorchooser/ColorModel.java src/share/classes/javax/swing/colorchooser/ColorModelCMYK.java src/share/classes/javax/swing/colorchooser/ColorModelHSL.java src/share/classes/javax/swing/colorchooser/ColorModelHSV.java src/share/classes/javax/swing/colorchooser/ColorPanel.java src/share/classes/javax/swing/colorchooser/DefaultHSBChooserPanel.java src/share/classes/javax/swing/colorchooser/DefaultRGBChooserPanel.java src/share/classes/javax/swing/colorchooser/DiagramComponent.java src/share/classes/javax/swing/colorchooser/SlidingSpinner.java src/share/classes/javax/swing/colorchooser/SyntheticImage.java src/share/classes/javax/swing/colorchooser/ValueFormatter.java src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java test/javax/swing/JColorChooser/Test6524757.java test/javax/swing/JColorChooser/Test6559154.java
diffstat 26 files changed, 1726 insertions(+), 1474 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties	Wed Jul 09 19:29:07 2008 +0400
+++ b/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties	Fri Jul 18 18:26:22 2008 +0400
@@ -101,30 +101,41 @@
 ColorChooser.sampleText=Sample Text  Sample Text
 ColorChooser.swatchesNameText=Swatches
 ColorChooser.swatchesMnemonic=83
-ColorChooser.swatchesDisplayedMnemonicIndex=0
 ColorChooser.swatchesRecentText=Recent:
-ColorChooser.hsbNameText=HSB
 # Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
 # constant, and an index into the text to render the mnemonic as. The
 # mnemonic is xxxMnemonic and the index of the character to underline is
 # xxxDisplayedMnemonicIndex.
-ColorChooser.hsbMnemonic=72
-ColorChooser.hsbDisplayedMnemonicIndex=0
-ColorChooser.hsbHueText=H
-ColorChooser.hsbSaturationText=S
-ColorChooser.hsbBrightnessText=B
-ColorChooser.hsbRedText=R
-ColorChooser.hsbGreenText=G
-ColorChooser.hsbBlueText=B
+ColorChooser.hsvNameText=HSV
+ColorChooser.hsvMnemonic=72
+ColorChooser.hsvHueText=Hue
+ColorChooser.hsvSaturationText=Saturation
+ColorChooser.hsvValueText=Value
+ColorChooser.hsvTransparencyText=Transparency
+ColorChooser.hslNameText=HSL
+ColorChooser.hslMnemonic=76
+ColorChooser.hslHueText=Hue
+ColorChooser.hslSaturationText=Saturation
+ColorChooser.hslLightnessText=Lightness
+ColorChooser.hslTransparencyText=Transparency
 ColorChooser.rgbNameText=RGB
 ColorChooser.rgbMnemonic=71
-ColorChooser.rgbDisplayedMnemonicIndex=1
 ColorChooser.rgbRedText=Red
 ColorChooser.rgbRedMnemonic=68
 ColorChooser.rgbGreenText=Green
 ColorChooser.rgbGreenMnemonic=78
 ColorChooser.rgbBlueText=Blue
 ColorChooser.rgbBlueMnemonic=66
+ColorChooser.rgbAlphaText=Alpha
+ColorChooser.rgbHexCodeText=Color Code
+ColorChooser.rgbHexCodeMnemonic=67
+ColorChooser.cmykNameText=CMYK
+ColorChooser.cmykMnemonic=77
+ColorChooser.cmykCyanText=Cyan
+ColorChooser.cmykMagentaText=Magenta
+ColorChooser.cmykYellowText=Yellow
+ColorChooser.cmykBlackText=Black
+ColorChooser.cmykAlphaText=Alpha
 
 ############ OPTION PANE STRINGS #############
 # Mnemonic keys correspond to KeyEvent.VK_XXX constant
--- a/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties	Wed Jul 09 19:29:07 2008 +0400
+++ b/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties	Fri Jul 18 18:26:22 2008 +0400
@@ -101,30 +101,41 @@
 ColorChooser.sampleText=Beispieltext  Beispieltext
 ColorChooser.swatchesNameText=Muster
 ColorChooser.swatchesMnemonic=77
-ColorChooser.swatchesDisplayedMnemonicIndex=0
 ColorChooser.swatchesRecentText=Aktuell:
-ColorChooser.hsbNameText=HSB
 # Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
 # constant, and an index into the text to render the mnemonic as. The
 # mnemonic is xxxMnemonic and the index of the character to underline is
 # xxxDisplayedMnemonicIndex.
-ColorChooser.hsbMnemonic=72
-ColorChooser.hsbDisplayedMnemonicIndex=0
-ColorChooser.hsbHueText=H
-ColorChooser.hsbSaturationText=S
-ColorChooser.hsbBrightnessText=B
-ColorChooser.hsbRedText=R
-ColorChooser.hsbGreenText=G
-ColorChooser.hsbBlueText=B
+ColorChooser.hsvNameText=HSV
+ColorChooser.hsvMnemonic=72
+ColorChooser.hsvHueText=Hue
+ColorChooser.hsvSaturationText=Saturation
+ColorChooser.hsvValueText=Value
+ColorChooser.hsvTransparencyText=Transparency
+ColorChooser.hslNameText=HSL
+ColorChooser.hslMnemonic=76
+ColorChooser.hslHueText=Hue
+ColorChooser.hslSaturationText=Saturation
+ColorChooser.hslLightnessText=Lightness
+ColorChooser.hslTransparencyText=Transparency
 ColorChooser.rgbNameText=RGB
 ColorChooser.rgbMnemonic=71
-ColorChooser.rgbDisplayedMnemonicIndex=1
 ColorChooser.rgbRedText=Rot
 ColorChooser.rgbRedMnemonic=82
 ColorChooser.rgbGreenText=Gr\u00fcn
 ColorChooser.rgbGreenMnemonic=78
 ColorChooser.rgbBlueText=Blau
 ColorChooser.rgbBlueMnemonic=66
+ColorChooser.rgbAlphaText=Alpha
+ColorChooser.rgbHexCodeText=Color Code
+ColorChooser.rgbHexCodeMnemonic=67
+ColorChooser.cmykNameText=CMYK
+ColorChooser.cmykMnemonic=77
+ColorChooser.cmykCyanText=Cyan
+ColorChooser.cmykMagentaText=Magenta
+ColorChooser.cmykYellowText=Yellow
+ColorChooser.cmykBlackText=Black
+ColorChooser.cmykAlphaText=Alpha
 
 ############ OPTION PANE STRINGS #############
 # Mnemonic keys correspond to KeyEvent.VK_XXX constant
--- a/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties	Wed Jul 09 19:29:07 2008 +0400
+++ b/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties	Fri Jul 18 18:26:22 2008 +0400
@@ -101,30 +101,41 @@
 ColorChooser.sampleText=Texto de ejemplo  Texto de ejemplo
 ColorChooser.swatchesNameText=Muestras
 ColorChooser.swatchesMnemonic=77
-ColorChooser.swatchesDisplayedMnemonicIndex=0
 ColorChooser.swatchesRecentText=Reciente:
-ColorChooser.hsbNameText=HSB
 # Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
 # constant, and an index into the text to render the mnemonic as. The
 # mnemonic is xxxMnemonic and the index of the character to underline is
 # xxxDisplayedMnemonicIndex.
-ColorChooser.hsbMnemonic=72
-ColorChooser.hsbDisplayedMnemonicIndex=0
-ColorChooser.hsbHueText=H
-ColorChooser.hsbSaturationText=S
-ColorChooser.hsbBrightnessText=B
-ColorChooser.hsbRedText=R
-ColorChooser.hsbGreenText=V
-ColorChooser.hsbBlueText=A
+ColorChooser.hsvNameText=HSV
+ColorChooser.hsvMnemonic=72
+ColorChooser.hsvHueText=Hue
+ColorChooser.hsvSaturationText=Saturation
+ColorChooser.hsvValueText=Value
+ColorChooser.hsvTransparencyText=Transparency
+ColorChooser.hslNameText=HSL
+ColorChooser.hslMnemonic=76
+ColorChooser.hslHueText=Hue
+ColorChooser.hslSaturationText=Saturation
+ColorChooser.hslLightnessText=Lightness
+ColorChooser.hslTransparencyText=Transparency
 ColorChooser.rgbNameText=RGB
 ColorChooser.rgbMnemonic=71
-ColorChooser.rgbDisplayedMnemonicIndex=1
 ColorChooser.rgbRedText=Rojo
 ColorChooser.rgbRedMnemonic=74
 ColorChooser.rgbGreenText=Verde
 ColorChooser.rgbGreenMnemonic=86
 ColorChooser.rgbBlueText=Azul
 ColorChooser.rgbBlueMnemonic=76
+ColorChooser.rgbAlphaText=Alpha
+ColorChooser.rgbHexCodeText=Color Code
+ColorChooser.rgbHexCodeMnemonic=67
+ColorChooser.cmykNameText=CMYK
+ColorChooser.cmykMnemonic=77
+ColorChooser.cmykCyanText=Cyan
+ColorChooser.cmykMagentaText=Magenta
+ColorChooser.cmykYellowText=Yellow
+ColorChooser.cmykBlackText=Black
+ColorChooser.cmykAlphaText=Alpha
 
 ############ OPTION PANE STRINGS #############
 # Mnemonic keys correspond to KeyEvent.VK_XXX constant
--- a/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties	Wed Jul 09 19:29:07 2008 +0400
+++ b/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties	Fri Jul 18 18:26:22 2008 +0400
@@ -101,30 +101,41 @@
 ColorChooser.sampleText=Echantillon de texte  Echantillon de texte
 ColorChooser.swatchesNameText=Echantillons
 ColorChooser.swatchesMnemonic=69
-ColorChooser.swatchesDisplayedMnemonicIndex=0
 ColorChooser.swatchesRecentText=Dernier :
-ColorChooser.hsbNameText=HSB
 # Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
 # constant, and an index into the text to render the mnemonic as. The
 # mnemonic is xxxMnemonic and the index of the character to underline is
 # xxxDisplayedMnemonicIndex.
-ColorChooser.hsbMnemonic=72
-ColorChooser.hsbDisplayedMnemonicIndex=0
-ColorChooser.hsbHueText=H
-ColorChooser.hsbSaturationText=S
-ColorChooser.hsbBrightnessText=B
-ColorChooser.hsbRedText=R
-ColorChooser.hsbGreenText=V
-ColorChooser.hsbBlueText=B
+ColorChooser.hsvNameText=HSV
+ColorChooser.hsvMnemonic=72
+ColorChooser.hsvHueText=Hue
+ColorChooser.hsvSaturationText=Saturation
+ColorChooser.hsvValueText=Value
+ColorChooser.hsvTransparencyText=Transparency
+ColorChooser.hslNameText=HSL
+ColorChooser.hslMnemonic=76
+ColorChooser.hslHueText=Hue
+ColorChooser.hslSaturationText=Saturation
+ColorChooser.hslLightnessText=Lightness
+ColorChooser.hslTransparencyText=Transparency
 ColorChooser.rgbNameText=RVB
 ColorChooser.rgbMnemonic=86
-ColorChooser.rgbDisplayedMnemonicIndex=1
 ColorChooser.rgbRedText=Rouge
 ColorChooser.rgbRedMnemonic=71
 ColorChooser.rgbGreenText=Vert
 ColorChooser.rgbGreenMnemonic=84
 ColorChooser.rgbBlueText=Bleu
 ColorChooser.rgbBlueMnemonic=66
+ColorChooser.rgbAlphaText=Alpha
+ColorChooser.rgbHexCodeText=Color Code
+ColorChooser.rgbHexCodeMnemonic=67
+ColorChooser.cmykNameText=CMYK
+ColorChooser.cmykMnemonic=77
+ColorChooser.cmykCyanText=Cyan
+ColorChooser.cmykMagentaText=Magenta
+ColorChooser.cmykYellowText=Yellow
+ColorChooser.cmykBlackText=Black
+ColorChooser.cmykAlphaText=Alpha
 
 ############ OPTION PANE STRINGS #############
 # Mnemonic keys correspond to KeyEvent.VK_XXX constant
--- a/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties	Wed Jul 09 19:29:07 2008 +0400
+++ b/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties	Fri Jul 18 18:26:22 2008 +0400
@@ -101,30 +101,41 @@
 ColorChooser.sampleText=Testo di prova          Testo di prova
 ColorChooser.swatchesNameText=Colori campione
 ColorChooser.swatchesMnemonic=67
-ColorChooser.swatchesDisplayedMnemonicIndex=0
 ColorChooser.swatchesRecentText=Recenti:
-ColorChooser.hsbNameText=HSB
 # Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
 # constant, and an index into the text to render the mnemonic as. The
 # mnemonic is xxxMnemonic and the index of the character to underline is
 # xxxDisplayedMnemonicIndex.
-ColorChooser.hsbMnemonic=72
-ColorChooser.hsbDisplayedMnemonicIndex=0
-ColorChooser.hsbHueText=H
-ColorChooser.hsbSaturationText=S
-ColorChooser.hsbBrightnessText=B
-ColorChooser.hsbRedText=R
-ColorChooser.hsbGreenText=G
-ColorChooser.hsbBlueText=B
+ColorChooser.hsvNameText=HSV
+ColorChooser.hsvMnemonic=72
+ColorChooser.hsvHueText=Hue
+ColorChooser.hsvSaturationText=Saturation
+ColorChooser.hsvValueText=Value
+ColorChooser.hsvTransparencyText=Transparency
+ColorChooser.hslNameText=HSL
+ColorChooser.hslMnemonic=76
+ColorChooser.hslHueText=Hue
+ColorChooser.hslSaturationText=Saturation
+ColorChooser.hslLightnessText=Lightness
+ColorChooser.hslTransparencyText=Transparency
 ColorChooser.rgbNameText=RGB
 ColorChooser.rgbMnemonic=71
-ColorChooser.rgbDisplayedMnemonicIndex=1
 ColorChooser.rgbRedText=Rosso
 ColorChooser.rgbRedMnemonic=79
 ColorChooser.rgbGreenText=Verde
 ColorChooser.rgbGreenMnemonic=69
 ColorChooser.rgbBlueText=Blu
 ColorChooser.rgbBlueMnemonic=66
+ColorChooser.rgbAlphaText=Alpha
+ColorChooser.rgbHexCodeText=Color Code
+ColorChooser.rgbHexCodeMnemonic=67
+ColorChooser.cmykNameText=CMYK
+ColorChooser.cmykMnemonic=77
+ColorChooser.cmykCyanText=Cyan
+ColorChooser.cmykMagentaText=Magenta
+ColorChooser.cmykYellowText=Yellow
+ColorChooser.cmykBlackText=Black
+ColorChooser.cmykAlphaText=Alpha
 
 ############ OPTION PANE STRINGS #############
 # Mnemonic keys correspond to KeyEvent.VK_XXX constant
--- a/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties	Wed Jul 09 19:29:07 2008 +0400
+++ b/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties	Fri Jul 18 18:26:22 2008 +0400
@@ -101,30 +101,41 @@
 ColorChooser.sampleText=\u30b5\u30f3\u30d7\u30eb\u30c6\u30ad\u30b9\u30c8 \u30b5\u30f3\u30d7\u30eb\u30c6\u30ad\u30b9\u30c8
 ColorChooser.swatchesNameText=\u30b5\u30f3\u30d7\u30eb(S)
 ColorChooser.swatchesMnemonic=83
-ColorChooser.swatchesDisplayedMnemonicIndex=5
 ColorChooser.swatchesRecentText=\u6700\u65b0:
-ColorChooser.hsbNameText=HSB
 # Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
 # constant, and an index into the text to render the mnemonic as. The
 # mnemonic is xxxMnemonic and the index of the character to underline is
 # xxxDisplayedMnemonicIndex.
-ColorChooser.hsbMnemonic=72
-ColorChooser.hsbDisplayedMnemonicIndex=0
-ColorChooser.hsbHueText=H
-ColorChooser.hsbSaturationText=S
-ColorChooser.hsbBrightnessText=B
-ColorChooser.hsbRedText=R
-ColorChooser.hsbGreenText=G
-ColorChooser.hsbBlueText=B
+ColorChooser.hsvNameText=HSV
+ColorChooser.hsvMnemonic=72
+ColorChooser.hsvHueText=Hue
+ColorChooser.hsvSaturationText=Saturation
+ColorChooser.hsvValueText=Value
+ColorChooser.hsvTransparencyText=Transparency
+ColorChooser.hslNameText=HSL
+ColorChooser.hslMnemonic=76
+ColorChooser.hslHueText=Hue
+ColorChooser.hslSaturationText=Saturation
+ColorChooser.hslLightnessText=Lightness
+ColorChooser.hslTransparencyText=Transparency
 ColorChooser.rgbNameText=RGB
 ColorChooser.rgbMnemonic=71
-ColorChooser.rgbDisplayedMnemonicIndex=1
 ColorChooser.rgbRedText=\u8d64(D)
 ColorChooser.rgbRedMnemonic=68
 ColorChooser.rgbGreenText=\u7dd1(N)
 ColorChooser.rgbGreenMnemonic=78
 ColorChooser.rgbBlueText=\u9752(B)
 ColorChooser.rgbBlueMnemonic=66
+ColorChooser.rgbAlphaText=Alpha
+ColorChooser.rgbHexCodeText=Color Code
+ColorChooser.rgbHexCodeMnemonic=67
+ColorChooser.cmykNameText=CMYK
+ColorChooser.cmykMnemonic=77
+ColorChooser.cmykCyanText=Cyan
+ColorChooser.cmykMagentaText=Magenta
+ColorChooser.cmykYellowText=Yellow
+ColorChooser.cmykBlackText=Black
+ColorChooser.cmykAlphaText=Alpha
 
 ############ OPTION PANE STRINGS #############
 # Mnemonic keys correspond to KeyEvent.VK_XXX constant
--- a/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties	Wed Jul 09 19:29:07 2008 +0400
+++ b/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties	Fri Jul 18 18:26:22 2008 +0400
@@ -101,30 +101,41 @@
 ColorChooser.sampleText=\uc0d8\ud50c \ud14d\uc2a4\ud2b8  \uc0d8\ud50c \ud14d\uc2a4\ud2b8
 ColorChooser.swatchesNameText=\uacac\ubcf8(S)
 ColorChooser.swatchesMnemonic=83
-ColorChooser.swatchesDisplayedMnemonicIndex=3
 ColorChooser.swatchesRecentText=\ucd5c\uadfc \ubaa9\ub85d:
-ColorChooser.hsbNameText=HSB
 # Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
 # constant, and an index into the text to render the mnemonic as. The
 # mnemonic is xxxMnemonic and the index of the character to underline is
 # xxxDisplayedMnemonicIndex.
-ColorChooser.hsbMnemonic=72
-ColorChooser.hsbDisplayedMnemonicIndex=0
-ColorChooser.hsbHueText=H
-ColorChooser.hsbSaturationText=S
-ColorChooser.hsbBrightnessText=B
-ColorChooser.hsbRedText=R
-ColorChooser.hsbGreenText=G
-ColorChooser.hsbBlueText=B
+ColorChooser.hsvNameText=HSV
+ColorChooser.hsvMnemonic=72
+ColorChooser.hsvHueText=Hue
+ColorChooser.hsvSaturationText=Saturation
+ColorChooser.hsvValueText=Value
+ColorChooser.hsvTransparencyText=Transparency
+ColorChooser.hslNameText=HSL
+ColorChooser.hslMnemonic=76
+ColorChooser.hslHueText=Hue
+ColorChooser.hslSaturationText=Saturation
+ColorChooser.hslLightnessText=Lightness
+ColorChooser.hslTransparencyText=Transparency
 ColorChooser.rgbNameText=RGB
 ColorChooser.rgbMnemonic=71
-ColorChooser.rgbDisplayedMnemonicIndex=1
 ColorChooser.rgbRedText=\ube68\uac04\uc0c9(D)
 ColorChooser.rgbRedMnemonic=68
 ColorChooser.rgbGreenText=\ub179\uc0c9(N)
 ColorChooser.rgbGreenMnemonic=78
 ColorChooser.rgbBlueText=\ud30c\ub780\uc0c9(B)
 ColorChooser.rgbBlueMnemonic=66
+ColorChooser.rgbAlphaText=Alpha
+ColorChooser.rgbHexCodeText=Color Code
+ColorChooser.rgbHexCodeMnemonic=67
+ColorChooser.cmykNameText=CMYK
+ColorChooser.cmykMnemonic=77
+ColorChooser.cmykCyanText=Cyan
+ColorChooser.cmykMagentaText=Magenta
+ColorChooser.cmykYellowText=Yellow
+ColorChooser.cmykBlackText=Black
+ColorChooser.cmykAlphaText=Alpha
 
 ############ OPTION PANE STRINGS #############
 # Mnemonic keys correspond to KeyEvent.VK_XXX constant
--- a/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties	Wed Jul 09 19:29:07 2008 +0400
+++ b/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties	Fri Jul 18 18:26:22 2008 +0400
@@ -101,30 +101,41 @@
 ColorChooser.sampleText=Exempeltext  Exempeltext
 ColorChooser.swatchesNameText=Prov
 ColorChooser.swatchesMnemonic=80
-ColorChooser.swatchesDisplayedMnemonicIndex=0
 ColorChooser.swatchesRecentText=Tidigare:
-ColorChooser.hsbNameText=HSB
 # Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
 # constant, and an index into the text to render the mnemonic as. The
 # mnemonic is xxxMnemonic and the index of the character to underline is
 # xxxDisplayedMnemonicIndex.
-ColorChooser.hsbMnemonic=72
-ColorChooser.hsbDisplayedMnemonicIndex=0
-ColorChooser.hsbHueText=H
-ColorChooser.hsbSaturationText=S
-ColorChooser.hsbBrightnessText=B
-ColorChooser.hsbRedText=R
-ColorChooser.hsbGreenText=G
-ColorChooser.hsbBlueText=B
+ColorChooser.hsvNameText=HSV
+ColorChooser.hsvMnemonic=72
+ColorChooser.hsvHueText=Hue
+ColorChooser.hsvSaturationText=Saturation
+ColorChooser.hsvValueText=Value
+ColorChooser.hsvTransparencyText=Transparency
+ColorChooser.hslNameText=HSL
+ColorChooser.hslMnemonic=76
+ColorChooser.hslHueText=Hue
+ColorChooser.hslSaturationText=Saturation
+ColorChooser.hslLightnessText=Lightness
+ColorChooser.hslTransparencyText=Transparency
 ColorChooser.rgbNameText=RGB
 ColorChooser.rgbMnemonic=71
-ColorChooser.rgbDisplayedMnemonicIndex=1
 ColorChooser.rgbRedText=R\u00f6d
 ColorChooser.rgbRedMnemonic=82
 ColorChooser.rgbGreenText=Gr\u00f6n
 ColorChooser.rgbGreenMnemonic=71
 ColorChooser.rgbBlueText=Bl\u00e5
 ColorChooser.rgbBlueMnemonic=66
+ColorChooser.rgbAlphaText=Alpha
+ColorChooser.rgbHexCodeText=Color Code
+ColorChooser.rgbHexCodeMnemonic=67
+ColorChooser.cmykNameText=CMYK
+ColorChooser.cmykMnemonic=77
+ColorChooser.cmykCyanText=Cyan
+ColorChooser.cmykMagentaText=Magenta
+ColorChooser.cmykYellowText=Yellow
+ColorChooser.cmykBlackText=Black
+ColorChooser.cmykAlphaText=Alpha
 
 ############ OPTION PANE STRINGS #############
 # Mnemonic keys correspond to KeyEvent.VK_XXX constant
--- a/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties	Wed Jul 09 19:29:07 2008 +0400
+++ b/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties	Fri Jul 18 18:26:22 2008 +0400
@@ -101,30 +101,41 @@
 ColorChooser.sampleText=\u6837\u54c1\u6587\u672c  \u6837\u54c1\u6587\u672c
 ColorChooser.swatchesNameText=\u6837\u54c1(S)
 ColorChooser.swatchesMnemonic=83
-ColorChooser.swatchesDisplayedMnemonicIndex=3
 ColorChooser.swatchesRecentText=\u6700\u8fd1:
-ColorChooser.hsbNameText=HSB
 # Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
 # constant, and an index into the text to render the mnemonic as. The
 # mnemonic is xxxMnemonic and the index of the character to underline is
 # xxxDisplayedMnemonicIndex.
-ColorChooser.hsbMnemonic=72
-ColorChooser.hsbDisplayedMnemonicIndex=0
-ColorChooser.hsbHueText=H
-ColorChooser.hsbSaturationText=S
-ColorChooser.hsbBrightnessText=B
-ColorChooser.hsbRedText=R
-ColorChooser.hsbGreenText=G
-ColorChooser.hsbBlueText=B
+ColorChooser.hsvNameText=HSV
+ColorChooser.hsvMnemonic=72
+ColorChooser.hsvHueText=Hue
+ColorChooser.hsvSaturationText=Saturation
+ColorChooser.hsvValueText=Value
+ColorChooser.hsvTransparencyText=Transparency
+ColorChooser.hslNameText=HSL
+ColorChooser.hslMnemonic=76
+ColorChooser.hslHueText=Hue
+ColorChooser.hslSaturationText=Saturation
+ColorChooser.hslLightnessText=Lightness
+ColorChooser.hslTransparencyText=Transparency
 ColorChooser.rgbNameText=RGB
 ColorChooser.rgbMnemonic=71
-ColorChooser.rgbDisplayedMnemonicIndex=1
 ColorChooser.rgbRedText=\u7ea2
 ColorChooser.rgbRedMnemonic=68
 ColorChooser.rgbGreenText=\u7eff
 ColorChooser.rgbGreenMnemonic=78
 ColorChooser.rgbBlueText=\u84dd
 ColorChooser.rgbBlueMnemonic=66
+ColorChooser.rgbAlphaText=Alpha
+ColorChooser.rgbHexCodeText=Color Code
+ColorChooser.rgbHexCodeMnemonic=67
+ColorChooser.cmykNameText=CMYK
+ColorChooser.cmykMnemonic=77
+ColorChooser.cmykCyanText=Cyan
+ColorChooser.cmykMagentaText=Magenta
+ColorChooser.cmykYellowText=Yellow
+ColorChooser.cmykBlackText=Black
+ColorChooser.cmykAlphaText=Alpha
 
 ############ OPTION PANE STRINGS #############
 # Mnemonic keys correspond to KeyEvent.VK_XXX constant
--- a/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties	Wed Jul 09 19:29:07 2008 +0400
+++ b/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties	Fri Jul 18 18:26:22 2008 +0400
@@ -101,30 +101,41 @@
 ColorChooser.sampleText=\u7bc4\u4f8b\u6587\u5b57  \u7bc4\u4f8b\u6587\u5b57
 ColorChooser.swatchesNameText=\u8abf\u8272\u677f(S)
 ColorChooser.swatchesMnemonic=83
-ColorChooser.swatchesDisplayedMnemonicIndex=4
 ColorChooser.swatchesRecentText=\u6700\u65b0\u9078\u64c7:
-ColorChooser.hsbNameText=HSB
 # Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
 # constant, and an index into the text to render the mnemonic as. The
 # mnemonic is xxxMnemonic and the index of the character to underline is
 # xxxDisplayedMnemonicIndex.
-ColorChooser.hsbMnemonic=72
-ColorChooser.hsbDisplayedMnemonicIndex=0
-ColorChooser.hsbHueText=H
-ColorChooser.hsbSaturationText=S
-ColorChooser.hsbBrightnessText=B
-ColorChooser.hsbRedText=R
-ColorChooser.hsbGreenText=G
-ColorChooser.hsbBlueText=B
+ColorChooser.hsvNameText=HSV
+ColorChooser.hsvMnemonic=72
+ColorChooser.hsvHueText=Hue
+ColorChooser.hsvSaturationText=Saturation
+ColorChooser.hsvValueText=Value
+ColorChooser.hsvTransparencyText=Transparency
+ColorChooser.hslNameText=HSL
+ColorChooser.hslMnemonic=76
+ColorChooser.hslHueText=Hue
+ColorChooser.hslSaturationText=Saturation
+ColorChooser.hslLightnessText=Lightness
+ColorChooser.hslTransparencyText=Transparency
 ColorChooser.rgbNameText=RGB
 ColorChooser.rgbMnemonic=71
-ColorChooser.rgbDisplayedMnemonicIndex=1
 ColorChooser.rgbRedText=\u7d05\u8272(D)
 ColorChooser.rgbRedMnemonic=68
 ColorChooser.rgbGreenText=\u7da0\u8272(N)
 ColorChooser.rgbGreenMnemonic=78
 ColorChooser.rgbBlueText=\u85cd\u8272(B)
 ColorChooser.rgbBlueMnemonic=66
+ColorChooser.rgbAlphaText=Alpha
+ColorChooser.rgbHexCodeText=Color Code
+ColorChooser.rgbHexCodeMnemonic=67
+ColorChooser.cmykNameText=CMYK
+ColorChooser.cmykMnemonic=77
+ColorChooser.cmykCyanText=Cyan
+ColorChooser.cmykMagentaText=Magenta
+ColorChooser.cmykYellowText=Yellow
+ColorChooser.cmykBlackText=Black
+ColorChooser.cmykAlphaText=Alpha
 
 ############ OPTION PANE STRINGS #############
 # Mnemonic keys correspond to KeyEvent.VK_XXX constant
--- a/src/share/classes/javax/swing/colorchooser/ColorChooserComponentFactory.java	Wed Jul 09 19:29:07 2008 +0400
+++ b/src/share/classes/javax/swing/colorchooser/ColorChooserComponentFactory.java	Fri Jul 18 18:26:22 2008 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2001 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,7 @@
 
 package javax.swing.colorchooser;
 
-import javax.swing.*;
-
-
+import javax.swing.JComponent;
 
 /**
  * A class designed to produce preconfigured "accessory" objects to
@@ -49,16 +47,17 @@
 
     private ColorChooserComponentFactory() { } // can't instantiate
 
-
     public static AbstractColorChooserPanel[] getDefaultChooserPanels() {
-        AbstractColorChooserPanel[] choosers = { new DefaultSwatchChooserPanel(),
-                                                 new DefaultHSBChooserPanel(),
-                                                 new DefaultRGBChooserPanel() };
-        return choosers;
+        return new AbstractColorChooserPanel[] {
+                new DefaultSwatchChooserPanel(),
+                new ColorChooserPanel(new ColorModelHSV()),
+                new ColorChooserPanel(new ColorModelHSL()),
+                new ColorChooserPanel(new ColorModel()),
+                new ColorChooserPanel(new ColorModelCMYK()),
+        };
     }
 
     public static JComponent getPreviewPanel() {
         return new DefaultPreviewPanel();
     }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/swing/colorchooser/ColorChooserPanel.java	Fri Jul 18 18:26:22 2008 +0400
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.swing.colorchooser;
+
+import java.awt.Color;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.Icon;
+import javax.swing.JComponent;
+import javax.swing.JFormattedTextField;
+import javax.swing.JLabel;
+import javax.swing.SwingConstants;
+
+final class ColorChooserPanel extends AbstractColorChooserPanel implements PropertyChangeListener {
+
+    private static final int MASK = 0xFF000000;
+    private final ColorModel model;
+    private final ColorPanel panel;
+    private final DiagramComponent slider;
+    private final DiagramComponent diagram;
+    private final JFormattedTextField text;
+    private final JLabel label;
+
+    ColorChooserPanel(ColorModel model) {
+        this.model = model;
+        this.panel = new ColorPanel(this.model);
+        this.slider = new DiagramComponent(this.panel, false);
+        this.diagram = new DiagramComponent(this.panel, true);
+        this.text = new JFormattedTextField();
+        this.label = new JLabel(null, null, SwingConstants.RIGHT);
+        ValueFormatter.init(6, true, this.text);
+    }
+
+    @Override
+    public void updateChooser() {
+        Color color = getColorFromModel();
+        this.panel.setColor(color);
+        this.text.setValue(Integer.valueOf(color.getRGB()));
+        this.slider.repaint();
+        this.diagram.repaint();
+    }
+
+    @Override
+    protected void buildChooser() {
+        if (0 == getComponentCount()) {
+            setLayout(new GridBagLayout());
+
+            GridBagConstraints gbc = new GridBagConstraints();
+
+            gbc.gridx = 3;
+            gbc.gridwidth = 2;
+            gbc.weighty = 1.0;
+            gbc.anchor = GridBagConstraints.NORTH;
+            gbc.fill = GridBagConstraints.HORIZONTAL;
+            gbc.insets.top = 10;
+            gbc.insets.right = 10;
+            add(this.panel, gbc);
+
+            gbc.gridwidth = 1;
+            gbc.weightx = 1.0;
+            gbc.weighty = 0.0;
+            gbc.anchor = GridBagConstraints.CENTER;
+            gbc.insets.right = 5;
+            gbc.insets.bottom = 10;
+            add(this.label, gbc);
+
+            gbc.gridx = 4;
+            gbc.weightx = 0.0;
+            gbc.insets.right = 10;
+            add(this.text, gbc);
+
+            gbc.gridx = 2;
+            gbc.gridheight = 2;
+            gbc.anchor = GridBagConstraints.NORTH;
+            gbc.ipadx = this.text.getPreferredSize().height;
+            gbc.ipady = getPreferredSize().height;
+            add(this.slider, gbc);
+
+            gbc.gridx = 1;
+            gbc.insets.left = 10;
+            gbc.ipadx = gbc.ipady;
+            add(this.diagram, gbc);
+
+            this.label.setLabelFor(this.text);
+            this.text.addPropertyChangeListener("value", this); // NON-NLS: the property name
+            this.slider.setBorder(this.text.getBorder());
+            this.diagram.setBorder(this.text.getBorder());
+
+            setInheritsPopupMenu(this, true); // CR:4966112
+        }
+        String label = this.model.getText(this, "HexCode"); // NON-NLS: suffix
+        boolean visible = label != null;
+        this.text.setVisible(visible);
+        this.label.setVisible(visible);
+        if (visible) {
+            this.label.setText(label);
+            int mnemonic = this.model.getInteger(this, "HexCodeMnemonic"); // NON-NLS: suffix
+            if (mnemonic > 0) {
+                this.label.setDisplayedMnemonic(mnemonic);
+                mnemonic = this.model.getInteger(this, "HexCodeMnemonicIndex"); // NON-NLS: suffix
+                if (mnemonic >= 0) {
+                    this.label.setDisplayedMnemonicIndex(mnemonic);
+                }
+            }
+        }
+        this.panel.buildPanel();
+    }
+
+    @Override
+    public String getDisplayName() {
+        return this.model.getText(this, "Name"); // NON-NLS: suffix
+    }
+
+    @Override
+    public int getMnemonic() {
+        return this.model.getInteger(this, "Mnemonic"); // NON-NLS: suffix
+    }
+
+    @Override
+    public int getDisplayedMnemonicIndex() {
+        return this.model.getInteger(this, "DisplayedMnemonicIndex"); // NON-NLS: suffix
+    }
+
+    @Override
+    public Icon getSmallDisplayIcon() {
+        return null;
+    }
+
+    @Override
+    public Icon getLargeDisplayIcon() {
+        return null;
+    }
+
+    public void propertyChange(PropertyChangeEvent event) {
+        Object object = event.getNewValue();
+        if (object instanceof Integer) {
+            int value = MASK & getColorFromModel().getRGB() | (Integer) object;
+            getColorSelectionModel().setSelectedColor(new Color(value, true));
+        }
+        this.text.selectAll();
+    }
+
+    /**
+     * Allows to show context popup for all components recursively.
+     *
+     * @param component  the root component of the tree
+     * @param value      whether or not the popup menu is inherited
+     */
+    private static void setInheritsPopupMenu(JComponent component, boolean value) {
+        component.setInheritsPopupMenu(value);
+        for (Object object : component.getComponents()) {
+            if (object instanceof JComponent) {
+                setInheritsPopupMenu((JComponent) object, value);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/swing/colorchooser/ColorModel.java	Fri Jul 18 18:26:22 2008 +0400
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.swing.colorchooser;
+
+import java.awt.Component;
+import javax.swing.UIManager;
+
+class ColorModel {
+
+    private final String prefix;
+    private final String[] labels;
+
+    ColorModel(String name, String... labels) {
+        this.prefix = "ColorChooser." + name; // NON-NLS: default prefix
+        this.labels = labels;
+    }
+
+    ColorModel() {
+        this("rgb", "Red", "Green", "Blue", "Alpha"); // NON-NLS: components
+    }
+
+    void setColor(int color, float[] model) {
+        model[0] = normalize(color >> 16);
+        model[1] = normalize(color >> 8);
+        model[2] = normalize(color);
+        model[3] = normalize(color >> 24);
+    }
+
+    int getColor(float[] model) {
+        return to8bit(model[2]) | (to8bit(model[1]) << 8) | (to8bit(model[0]) << 16) | (to8bit(model[3]) << 24);
+    }
+
+    int getCount() {
+        return this.labels.length;
+    }
+
+    int getMinimum(int index) {
+        return 0;
+    }
+
+    int getMaximum(int index) {
+        return 255;
+    }
+
+    float getDefault(int index) {
+        return 0.0f;
+    }
+
+    final String getLabel(Component component, int index) {
+        return getText(component, this.labels[index]);
+    }
+
+    private static float normalize(int value) {
+        return (float) (value & 0xFF) / 255.0f;
+    }
+
+    private static int to8bit(float value) {
+        return (int) (255.0f * value);
+    }
+
+    final String getText(Component component, String suffix) {
+        return UIManager.getString(this.prefix + suffix + "Text", component.getLocale()); // NON-NLS: default postfix
+    }
+
+    final int getInteger(Component component, String suffix) {
+        Object value = UIManager.get(this.prefix + suffix, component.getLocale());
+        if (value instanceof Integer) {
+            return (Integer) value;
+        }
+        if (value instanceof String) {
+            try {
+                return Integer.parseInt((String) value);
+            }
+            catch (NumberFormatException exception) {
+            }
+        }
+        return -1;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/swing/colorchooser/ColorModelCMYK.java	Fri Jul 18 18:26:22 2008 +0400
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.swing.colorchooser;
+
+final class ColorModelCMYK extends ColorModel {
+
+    ColorModelCMYK() {
+        super("cmyk", "Cyan", "Magenta", "Yellow", "Black", "Alpha"); // NON-NLS: components
+    }
+
+    @Override
+    void setColor(int color, float[] space) {
+        super.setColor(color, space);
+        space[4] = space[3];
+        RGBtoCMYK(space, space);
+    }
+
+    @Override
+    int getColor(float[] space) {
+        CMYKtoRGB(space, space);
+        space[3] = space[4];
+        return super.getColor(space);
+    }
+
+    /**
+     * Converts CMYK components of a color to a set of RGB components.
+     *
+     * @param cmyk  a float array with length equal to
+     *              the number of CMYK components
+     * @param rgb   a float array with length of at least 3
+     *              that contains RGB components of a color
+     * @return a float array that contains RGB components
+     */
+    private static float[] CMYKtoRGB(float[] cmyk, float[] rgb) {
+        if (rgb == null) {
+            rgb = new float[3];
+        }
+        rgb[0] = 1.0f + cmyk[0] * cmyk[3] - cmyk[3] - cmyk[0];
+        rgb[1] = 1.0f + cmyk[1] * cmyk[3] - cmyk[3] - cmyk[1];
+        rgb[2] = 1.0f + cmyk[2] * cmyk[3] - cmyk[3] - cmyk[2];
+        return rgb;
+    }
+
+    /**
+     * Converts RGB components of a color to a set of CMYK components.
+     *
+     * @param rgb   a float array with length of at least 3
+     *              that contains RGB components of a color
+     * @param cmyk  a float array with length equal to
+     *              the number of CMYK components
+     * @return a float array that contains CMYK components
+     */
+    private static float[] RGBtoCMYK(float[] rgb, float[] cmyk) {
+        if (cmyk == null) {
+            cmyk = new float[4];
+        }
+        float max = ColorModelHSL.max(rgb[0], rgb[1], rgb[2]);
+        if (max > 0.0f) {
+            cmyk[0] = 1.0f - rgb[0] / max;
+            cmyk[1] = 1.0f - rgb[1] / max;
+            cmyk[2] = 1.0f - rgb[2] / max;
+        }
+        else {
+            cmyk[0] = 0.0f;
+            cmyk[1] = 0.0f;
+            cmyk[2] = 0.0f;
+        }
+        cmyk[3] = 1.0f - max;
+        return cmyk;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/swing/colorchooser/ColorModelHSL.java	Fri Jul 18 18:26:22 2008 +0400
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.swing.colorchooser;
+
+final class ColorModelHSL extends ColorModel {
+
+    ColorModelHSL() {
+        super("hsl", "Hue", "Saturation", "Lightness", "Transparency"); // NON-NLS: components
+    }
+
+    @Override
+    void setColor(int color, float[] space) {
+        super.setColor(color, space);
+        RGBtoHSL(space, space);
+        space[3] = 1.0f - space[3];
+    }
+
+    @Override
+    int getColor(float[] space) {
+        space[3] = 1.0f - space[3];
+        HSLtoRGB(space, space);
+        return super.getColor(space);
+    }
+
+    @Override
+    int getMaximum(int index) {
+        return (index == 0) ? 360 : 100;
+    }
+
+    @Override
+    float getDefault(int index) {
+        return (index == 0) ? -1.0f : (index == 2) ? 0.5f : 1.0f;
+    }
+
+    /**
+     * Converts HSL components of a color to a set of RGB components.
+     *
+     * @param hsl  a float array with length equal to
+     *             the number of HSL components
+     * @param rgb  a float array with length of at least 3
+     *             that contains RGB components of a color
+     * @return a float array that contains RGB components
+     */
+    private static float[] HSLtoRGB(float[] hsl, float[] rgb) {
+        if (rgb == null) {
+            rgb = new float[3];
+        }
+        float hue = hsl[0];
+        float saturation = hsl[1];
+        float lightness = hsl[2];
+
+        if (saturation > 0.0f) {
+            hue = (hue < 1.0f) ? hue * 6.0f : 0.0f;
+            float q = lightness + saturation * ((lightness > 0.5f) ? 1.0f - lightness : lightness);
+            float p = 2.0f * lightness - q;
+            rgb[0]= normalize(q, p, (hue < 4.0f) ? (hue + 2.0f) : (hue - 4.0f));
+            rgb[1]= normalize(q, p, hue);
+            rgb[2]= normalize(q, p, (hue < 2.0f) ? (hue + 4.0f) : (hue - 2.0f));
+        }
+        else {
+            rgb[0] = lightness;
+            rgb[1] = lightness;
+            rgb[2] = lightness;
+        }
+        return rgb;
+    }
+
+    /**
+     * Converts RGB components of a color to a set of HSL components.
+     *
+     * @param rgb  a float array with length of at least 3
+     *             that contains RGB components of a color
+     * @param hsl  a float array with length equal to
+     *             the number of HSL components
+     * @return a float array that contains HSL components
+     */
+    private static float[] RGBtoHSL(float[] rgb, float[] hsl) {
+        if (hsl == null) {
+            hsl = new float[3];
+        }
+        float max = max(rgb[0], rgb[1], rgb[2]);
+        float min = min(rgb[0], rgb[1], rgb[2]);
+
+        float summa = max + min;
+        float saturation = max - min;
+        if (saturation > 0.0f) {
+            saturation /= (summa > 1.0f)
+                    ? 2.0f - summa
+                    : summa;
+        }
+        hsl[0] = getHue(rgb[0], rgb[1], rgb[2], max, min);
+        hsl[1] = saturation;
+        hsl[2] = summa / 2.0f;
+        return hsl;
+    }
+
+    /**
+     * Returns the smaller of three color components.
+     *
+     * @param red    the red component of the color
+     * @param green  the green component of the color
+     * @param blue   the blue component of the color
+     * @return the smaller of {@code red}, {@code green} and {@code blue}
+     */
+    static float min(float red, float green, float blue) {
+        float min = (red < green) ? red : green;
+        return (min < blue) ? min : blue;
+    }
+
+    /**
+     * Returns the larger of three color components.
+     *
+     * @param red    the red component of the color
+     * @param green  the green component of the color
+     * @param blue   the blue component of the color
+     * @return the larger of {@code red}, {@code green} and {@code blue}
+     */
+    static float max(float red, float green, float blue) {
+        float max = (red > green) ? red : green;
+        return (max > blue) ? max : blue;
+    }
+
+    /**
+     * Calculates the hue component for HSL and HSV color spaces.
+     *
+     * @param red    the red component of the color
+     * @param green  the green component of the color
+     * @param blue   the blue component of the color
+     * @param max    the larger of {@code red}, {@code green} and {@code blue}
+     * @param min    the smaller of {@code red}, {@code green} and {@code blue}
+     * @return the hue component
+     */
+    static float getHue(float red, float green, float blue, float max, float min) {
+        float hue = max - min;
+        if (hue > 0.0f) {
+            if (max == red) {
+                hue = (green - blue) / hue;
+                if (hue < 0.0f) {
+                    hue += 6.0f;
+                }
+            }
+            else if (max == green) {
+                hue = 2.0f + (blue - red) / hue;
+            }
+            else /*max == blue*/ {
+                hue = 4.0f + (red - green) / hue;
+            }
+            hue /= 6.0f;
+        }
+        return hue;
+    }
+
+    private static float normalize(float q, float p, float color) {
+        if (color < 1.0f) {
+            return p + (q - p) * color;
+        }
+        if (color < 3.0f) {
+            return q;
+        }
+        if (color < 4.0f) {
+            return p + (q - p) * (4.0f - color);
+        }
+        return p;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/swing/colorchooser/ColorModelHSV.java	Fri Jul 18 18:26:22 2008 +0400
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.swing.colorchooser;
+
+final class ColorModelHSV extends ColorModel {
+
+    ColorModelHSV() {
+        super("hsv", "Hue", "Saturation", "Value", "Transparency"); // NON-NLS: components
+    }
+
+    @Override
+    void setColor(int color, float[] space) {
+        super.setColor(color, space);
+        RGBtoHSV(space, space);
+        space[3] = 1.0f - space[3];
+    }
+
+    @Override
+    int getColor(float[] space) {
+        space[3] = 1.0f - space[3];
+        HSVtoRGB(space, space);
+        return super.getColor(space);
+    }
+
+    @Override
+    int getMaximum(int index) {
+        return (index == 0) ? 360 : 100;
+    }
+
+    @Override
+    float getDefault(int index) {
+        return (index == 0) ? -1.0f : 1.0f;
+    }
+
+    /**
+     * Converts HSV components of a color to a set of RGB components.
+     *
+     * @param hsv  a float array with length equal to
+     *             the number of HSV components
+     * @param rgb  a float array with length of at least 3
+     *             that contains RGB components of a color
+     * @return a float array that contains RGB components
+     */
+    private static float[] HSVtoRGB(float[] hsv, float[] rgb) {
+        if (rgb == null) {
+            rgb = new float[3];
+        }
+        float hue = hsv[0];
+        float saturation = hsv[1];
+        float value = hsv[2];
+
+        rgb[0] = value;
+        rgb[1] = value;
+        rgb[2] = value;
+
+        if (saturation > 0.0f) {
+            hue = (hue < 1.0f) ? hue * 6.0f : 0.0f;
+            int integer = (int) hue;
+            float f = hue - (float) integer;
+            switch (integer) {
+                case 0:
+                    rgb[1] *= 1.0f - saturation * (1.0f - f);
+                    rgb[2] *= 1.0f - saturation;
+                    break;
+                case 1:
+                    rgb[0] *= 1.0f - saturation * f;
+                    rgb[2] *= 1.0f - saturation;
+                    break;
+                case 2:
+                    rgb[0] *= 1.0f - saturation;
+                    rgb[2] *= 1.0f - saturation * (1.0f - f);
+                    break;
+                case 3:
+                    rgb[0] *= 1.0f - saturation;
+                    rgb[1] *= 1.0f - saturation * f;
+                    break;
+                case 4:
+                    rgb[0] *= 1.0f - saturation * (1.0f - f);
+                    rgb[1] *= 1.0f - saturation;
+                    break;
+                case 5:
+                    rgb[1] *= 1.0f - saturation;
+                    rgb[2] *= 1.0f - saturation * f;
+                    break;
+            }
+        }
+        return rgb;
+    }
+
+    /**
+     * Converts RGB components of a color to a set of HSV components.
+     *
+     * @param rgb  a float array with length of at least 3
+     *             that contains RGB components of a color
+     * @param hsv  a float array with length equal to
+     *             the number of HSV components
+     * @return a float array that contains HSV components
+     */
+    private static float[] RGBtoHSV(float[] rgb, float[] hsv) {
+        if (hsv == null) {
+            hsv = new float[3];
+        }
+        float max = ColorModelHSL.max(rgb[0], rgb[1], rgb[2]);
+        float min = ColorModelHSL.min(rgb[0], rgb[1], rgb[2]);
+
+        float saturation = max - min;
+        if (saturation > 0.0f) {
+            saturation /= max;
+        }
+        hsv[0] = ColorModelHSL.getHue(rgb[0], rgb[1], rgb[2], max, min);
+        hsv[1] = saturation;
+        hsv[2] = max;
+        return hsv;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/swing/colorchooser/ColorPanel.java	Fri Jul 18 18:26:22 2008 +0400
@@ -0,0 +1,210 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.swing.colorchooser;
+
+import java.awt.Color;
+import java.awt.ContainerOrderFocusTraversalPolicy;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.ButtonGroup;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.border.EmptyBorder;
+
+final class ColorPanel extends JPanel implements ActionListener {
+
+    private final SlidingSpinner[] spinners = new SlidingSpinner[5];
+    private final float[] values = new float[this.spinners.length];
+
+    private final ColorModel model;
+    private Color color;
+    private int x = 1;
+    private int y = 2;
+    private int z;
+
+    ColorPanel(ColorModel model) {
+        super(new GridBagLayout());
+
+        GridBagConstraints gbc = new GridBagConstraints();
+        gbc.fill = GridBagConstraints.HORIZONTAL;
+
+        gbc.gridx = 1;
+        ButtonGroup group = new ButtonGroup();
+        EmptyBorder border = null;
+        for (int i = 0; i < this.spinners.length; i++) {
+            if (i < 3) {
+                JRadioButton button = new JRadioButton();
+                if (i == 0) {
+                    Insets insets = button.getInsets();
+                    insets.left = button.getPreferredSize().width;
+                    border = new EmptyBorder(insets);
+                    button.setSelected(true);
+                    gbc.insets.top = 5;
+                }
+                add(button, gbc);
+                group.add(button);
+                button.setActionCommand(Integer.toString(i));
+                button.addActionListener(this);
+                this.spinners[i] = new SlidingSpinner(this, button);
+            }
+            else {
+                JLabel label = new JLabel();
+                add(label, gbc);
+                label.setBorder(border);
+                label.setFocusable(false);
+                this.spinners[i] = new SlidingSpinner(this, label);
+            }
+        }
+        gbc.gridx = 2;
+        gbc.weightx = 1.0;
+        gbc.insets.top = 0;
+        gbc.insets.left = 5;
+        for (SlidingSpinner spinner : this.spinners) {
+            add(spinner.getSlider(), gbc);
+            gbc.insets.top = 5;
+        }
+        gbc.gridx = 3;
+        gbc.weightx = 0.0;
+        gbc.insets.top = 0;
+        for (SlidingSpinner spinner : this.spinners) {
+            add(spinner.getSpinner(), gbc);
+            gbc.insets.top = 5;
+        }
+        setFocusTraversalPolicy(new ContainerOrderFocusTraversalPolicy());
+        setFocusTraversalPolicyProvider(true);
+        setFocusable(false);
+
+        this.model = model;
+    }
+
+    public void actionPerformed(ActionEvent event) {
+        try {
+            this.z = Integer.parseInt(event.getActionCommand());
+            this.y = (this.z != 2) ? 2 : 1;
+            this.x = (this.z != 0) ? 0 : 1;
+            getParent().repaint();
+        }
+        catch (NumberFormatException exception) {
+        }
+    }
+
+    void buildPanel() {
+        int count = this.model.getCount();
+        this.spinners[4].setVisible(count > 4);
+        for (int i = 0; i < count; i++) {
+            Object object = this.spinners[i].getLabel();
+            if (object instanceof JRadioButton) {
+                JRadioButton button = (JRadioButton) object;
+                button.setText(this.model.getLabel(this, i));
+            }
+            else if (object instanceof JLabel) {
+                JLabel label = (JLabel) object;
+                label.setText(this.model.getLabel(this, i));
+            }
+            this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i));
+            this.spinners[i].setValue(this.values[i]);
+        }
+    }
+
+    void colorChanged() {
+        this.color = new Color(getColor(0), true);
+        Object parent = getParent();
+        if (parent instanceof ColorChooserPanel) {
+            ColorChooserPanel chooser = (ColorChooserPanel) parent;
+            chooser.getColorSelectionModel().setSelectedColor(this.color);
+            chooser.repaint();
+        }
+    }
+
+    float getValueX() {
+        return this.spinners[this.x].getValue();
+    }
+
+    float getValueY() {
+        return 1.0f - this.spinners[this.y].getValue();
+    }
+
+    float getValueZ() {
+        return 1.0f - this.spinners[this.z].getValue();
+    }
+
+    void setValue(float z) {
+        this.spinners[this.z].setValue(1.0f - z);
+        colorChanged();
+    }
+
+    void setValue(float x, float y) {
+        this.spinners[this.x].setValue(x);
+        this.spinners[this.y].setValue(1.0f - y);
+        colorChanged();
+    }
+
+    int getColor(float z) {
+        setDefaultValue(this.x);
+        setDefaultValue(this.y);
+        this.values[this.z] = 1.0f - z;
+        return getColor(3);
+    }
+
+    int getColor(float x, float y) {
+        this.values[this.x] = x;
+        this.values[this.y] = 1.0f - y;
+        setValue(this.z);
+        return getColor(3);
+    }
+
+    void setColor(Color color) {
+        if (!color.equals(this.color)) {
+            this.color = color;
+            this.model.setColor(color.getRGB(), this.values);
+            for (int i = 0; i < this.model.getCount(); i++) {
+                this.spinners[i].setValue(this.values[i]);
+            }
+        }
+    }
+
+    private int getColor(int index) {
+        while (index < this.model.getCount()) {
+            setValue(index++);
+        }
+        return this.model.getColor(this.values);
+    }
+
+    private void setValue(int index) {
+        this.values[index] = this.spinners[index].getValue();
+    }
+
+    private void setDefaultValue(int index) {
+        float value = this.model.getDefault(index);
+        this.values[index] = (value < 0.0f)
+                ? this.spinners[index].getValue()
+                : value;
+    }
+}
--- a/src/share/classes/javax/swing/colorchooser/DefaultHSBChooserPanel.java	Wed Jul 09 19:29:07 2008 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,801 +0,0 @@
-/*
- * Copyright 1998-2004 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package javax.swing.colorchooser;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.event.*;
-import javax.swing.border.*;
-import java.awt.image.*;
-import java.util.Locale;
-
-/**
- * Implements the default HSB Color chooser
- *
- *  @author Tom Santos
- *  @author Steve Wilson
- *  @author Mark Davidson
- *  @author Shannon Hickey
- */
-class DefaultHSBChooserPanel extends AbstractColorChooserPanel implements ChangeListener, HierarchyListener {
-
-    private transient HSBImage palette;
-    private transient HSBImage sliderPalette;
-
-    private transient Image paletteImage;
-    private transient Image sliderPaletteImage;
-
-    private JSlider slider;
-    private JSpinner hField;
-    private JSpinner sField;
-    private JSpinner bField;
-
-    private JTextField redField;
-    private JTextField greenField;
-    private JTextField blueField;
-
-    private boolean isAdjusting = false; // Flag which indicates that values are set internally
-    private Point paletteSelection = new Point();
-    private JLabel paletteLabel;
-    private JLabel sliderPaletteLabel;
-
-    private JRadioButton hRadio;
-    private JRadioButton sRadio;
-    private JRadioButton bRadio;
-
-    private static final int PALETTE_DIMENSION = 200;
-    private static final int MAX_HUE_VALUE = 359;
-    private static final int MAX_SATURATION_VALUE = 100;
-    private static final int MAX_BRIGHTNESS_VALUE = 100;
-
-    private int currentMode = HUE_MODE;
-
-    private static final int HUE_MODE = 0;
-    private static final int SATURATION_MODE = 1;
-    private static final int BRIGHTNESS_MODE = 2;
-
-    public DefaultHSBChooserPanel() {
-    }
-
-    private void addPaletteListeners() {
-        paletteLabel.addMouseListener(new MouseAdapter() {
-            public void mousePressed(MouseEvent e ) {
-                float[] hsb = new float[3];
-                palette.getHSBForLocation( e.getX(), e.getY(), hsb );
-                updateHSB( hsb[0], hsb[1], hsb[2] );
-            }
-        });
-
-        paletteLabel.addMouseMotionListener(new MouseMotionAdapter() {
-            public void mouseDragged( MouseEvent e ){
-                int labelWidth = paletteLabel.getWidth();
-
-                int labelHeight = paletteLabel.getHeight();
-                int x = e.getX();
-                int y = e.getY();
-
-                if ( x >= labelWidth ) {
-                    x = labelWidth - 1;
-                }
-
-                if ( y >= labelHeight ) {
-                    y = labelHeight - 1;
-                }
-
-                if ( x < 0 ) {
-                    x = 0;
-                }
-
-                if ( y < 0 ) {
-                    y = 0;
-                }
-
-                float[] hsb = new float[3];
-                palette.getHSBForLocation( x, y, hsb );
-                updateHSB( hsb[0], hsb[1], hsb[2] );
-            }
-        });
-    }
-
-    private void updatePalette( float h, float s, float b ) {
-        int x = 0;
-        int y = 0;
-
-        switch ( currentMode ) {
-        case HUE_MODE:
-            if ( h != palette.getHue() ) {
-                palette.setHue( h );
-                palette.nextFrame();
-            }
-            x = PALETTE_DIMENSION - (int)(s * PALETTE_DIMENSION);
-            y = PALETTE_DIMENSION - (int)(b * PALETTE_DIMENSION);
-            break;
-        case SATURATION_MODE:
-            if ( s != palette.getSaturation() ) {
-                palette.setSaturation( s );
-                palette.nextFrame();
-            }
-            x = (int)(h * PALETTE_DIMENSION);
-            y = PALETTE_DIMENSION - (int)(b * PALETTE_DIMENSION);
-            break;
-        case BRIGHTNESS_MODE:
-            if ( b != palette.getBrightness() ) {
-                palette.setBrightness( b );
-                palette.nextFrame();
-            }
-            x = (int)(h * PALETTE_DIMENSION);
-            y = PALETTE_DIMENSION - (int)(s * PALETTE_DIMENSION);
-            break;
-        }
-
-        paletteSelection.setLocation( x, y );
-        paletteLabel.repaint();
-    }
-
-    private void updateSlider( float h, float s, float b ) {
-        // Update the slider palette if necessary.
-        // When the slider is the hue slider or the hue hasn't changed,
-        // the hue of the palette will not need to be updated.
-        if (currentMode != HUE_MODE && h != sliderPalette.getHue() ) {
-            sliderPalette.setHue( h );
-            sliderPalette.nextFrame();
-        }
-
-        float value = 0f;
-
-        switch ( currentMode ) {
-        case HUE_MODE:
-            value = h;
-            break;
-        case SATURATION_MODE:
-            value = s;
-            break;
-        case BRIGHTNESS_MODE:
-            value = b;
-            break;
-        }
-
-        slider.setValue( Math.round(value * (slider.getMaximum())) );
-    }
-
-    private void updateHSBTextFields( float hue, float saturation, float brightness ) {
-        int h =  Math.round(hue * 359);
-        int s =  Math.round(saturation * 100);
-        int b =  Math.round(brightness * 100);
-
-        if (((Integer)hField.getValue()).intValue() != h) {
-            hField.setValue(new Integer(h));
-        }
-        if (((Integer)sField.getValue()).intValue() != s) {
-            sField.setValue(new Integer(s));
-        }
-        if (((Integer)bField.getValue()).intValue() != b) {
-            bField.setValue(new Integer(b));
-        }
-    }
-
-    /**
-     * Updates the values of the RGB fields to reflect the new color change
-     */
-    private void updateRGBTextFields( Color color ) {
-        redField.setText(String.valueOf(color.getRed()));
-        greenField.setText(String.valueOf(color.getGreen()));
-        blueField.setText(String.valueOf(color.getBlue()));
-    }
-
-    /**
-     * Main internal method of updating the ui controls and the color model.
-     */
-    private void updateHSB( float h, float s, float b ) {
-        if ( !isAdjusting ) {
-            isAdjusting = true;
-
-            updatePalette( h, s, b );
-            updateSlider( h, s, b );
-            updateHSBTextFields( h, s, b );
-
-            Color color = Color.getHSBColor(h, s, b);
-            updateRGBTextFields( color );
-
-            getColorSelectionModel().setSelectedColor( color );
-
-            isAdjusting = false;
-        }
-    }
-
-    /**
-      * Invoked automatically when the model's state changes.
-      * It is also called by <code>installChooserPanel</code> to allow
-      * you to set up the initial state of your chooser.
-      * Override this method to update your <code>ChooserPanel</code>.
-      */
-    public void updateChooser() {
-        if ( !isAdjusting ) {
-            float[] hsb = getHSBColorFromModel();
-            updateHSB( hsb[0], hsb[1], hsb[2] );
-        }
-    }
-
-    public void installChooserPanel(JColorChooser enclosingChooser) {
-        super.installChooserPanel(enclosingChooser);
-        setInheritsPopupMenu(true);
-        addHierarchyListener(this);
-    }
-
-    /**
-     * Invoked when the panel is removed from the chooser.
-     */
-    public void uninstallChooserPanel(JColorChooser enclosingChooser) {
-        super.uninstallChooserPanel(enclosingChooser);
-        cleanupPalettesIfNecessary();
-        removeAll();
-        removeHierarchyListener(this);
-    }
-
-    /**
-     * Returns an float array containing the HSB values of the selected color from
-     * the ColorSelectionModel
-     */
-    private float[] getHSBColorFromModel()  {
-        Color color = getColorFromModel();
-        float[] hsb = new float[3];
-        Color.RGBtoHSB( color.getRed(), color.getGreen(), color.getBlue(), hsb );
-
-        return hsb;
-    }
-
-    /**
-     * Builds a new chooser panel.
-     */
-    protected void buildChooser() {
-        setLayout(new BorderLayout());
-        JComponent spp = buildSliderPalettePanel();
-        spp.setInheritsPopupMenu(true);
-        add(spp, BorderLayout.BEFORE_LINE_BEGINS);
-
-        JPanel controlHolder = new JPanel(new SmartGridLayout(1,3));
-        JComponent hsbControls = buildHSBControls();
-        hsbControls.setInheritsPopupMenu(true);
-        controlHolder.add(hsbControls);
-
-        controlHolder.add(new JLabel(" ")); // spacer
-
-        JComponent rgbControls = buildRGBControls();
-        rgbControls.setInheritsPopupMenu(true);
-        controlHolder.add(rgbControls);
-        controlHolder.setInheritsPopupMenu(true);
-
-        controlHolder.setBorder(new EmptyBorder( 10, 5, 10, 5));
-        add( controlHolder, BorderLayout.CENTER);
-    }
-
-    /**
-     * Creates the panel with the uneditable RGB field
-     */
-    private JComponent buildRGBControls() {
-        JPanel panel = new JPanel(new SmartGridLayout(2,3));
-        panel.setInheritsPopupMenu(true);
-
-        Color color = getColorFromModel();
-        redField = new JTextField( String.valueOf(color.getRed()), 3 );
-        redField.setEditable(false);
-        redField.setHorizontalAlignment( JTextField.RIGHT );
-        redField.setInheritsPopupMenu(true);
-
-        greenField = new JTextField(String.valueOf(color.getGreen()), 3 );
-        greenField.setEditable(false);
-        greenField.setHorizontalAlignment( JTextField.RIGHT );
-        greenField.setInheritsPopupMenu(true);
-
-        blueField = new JTextField( String.valueOf(color.getBlue()), 3 );
-        blueField.setEditable(false);
-        blueField.setHorizontalAlignment( JTextField.RIGHT );
-        blueField.setInheritsPopupMenu(true);
-
-        Locale locale = getLocale();
-        String redString = UIManager.getString("ColorChooser.hsbRedText", locale);
-        String greenString = UIManager.getString("ColorChooser.hsbGreenText", locale);
-        String blueString = UIManager.getString("ColorChooser.hsbBlueText", locale);
-
-        panel.add( new JLabel(redString) );
-        panel.add( redField );
-        panel.add( new JLabel(greenString) );
-        panel.add( greenField );
-        panel.add( new JLabel(blueString) );
-        panel.add( blueField );
-
-        return panel;
-    }
-
-    /**
-     * Creates the panel with the editable HSB fields and the radio buttons.
-     */
-    private JComponent buildHSBControls() {
-
-        Locale locale = getLocale();
-        String hueString = UIManager.getString("ColorChooser.hsbHueText", locale);
-        String saturationString = UIManager.getString("ColorChooser.hsbSaturationText", locale);
-        String brightnessString = UIManager.getString("ColorChooser.hsbBrightnessText", locale);
-
-        RadioButtonHandler handler = new RadioButtonHandler();
-
-        hRadio = new JRadioButton(hueString);
-        hRadio.addActionListener(handler);
-        hRadio.setSelected(true);
-        hRadio.setInheritsPopupMenu(true);
-
-        sRadio = new JRadioButton(saturationString);
-        sRadio.addActionListener(handler);
-        sRadio.setInheritsPopupMenu(true);
-
-        bRadio = new JRadioButton(brightnessString);
-        bRadio.addActionListener(handler);
-        bRadio.setInheritsPopupMenu(true);
-
-        ButtonGroup group = new ButtonGroup();
-        group.add(hRadio);
-        group.add(sRadio);
-        group.add(bRadio);
-
-        float[] hsb = getHSBColorFromModel();
-
-        hField = new JSpinner(new SpinnerNumberModel((int)(hsb[0] * 359), 0, 359, 1));
-        sField = new JSpinner(new SpinnerNumberModel((int)(hsb[1] * 100), 0, 100, 1));
-        bField = new JSpinner(new SpinnerNumberModel((int)(hsb[2] * 100), 0, 100, 1));
-
-        hField.addChangeListener(this);
-        sField.addChangeListener(this);
-        bField.addChangeListener(this);
-
-        hField.setInheritsPopupMenu(true);
-        sField.setInheritsPopupMenu(true);
-        bField.setInheritsPopupMenu(true);
-
-        JPanel panel = new JPanel( new SmartGridLayout(2, 3) );
-
-        panel.add(hRadio);
-        panel.add(hField);
-        panel.add(sRadio);
-        panel.add(sField);
-        panel.add(bRadio);
-        panel.add(bField);
-        panel.setInheritsPopupMenu(true);
-
-        return panel;
-    }
-
-    /**
-     * Handler for the radio button classes.
-     */
-    private class RadioButtonHandler implements ActionListener  {
-        public void actionPerformed(ActionEvent evt)  {
-            Object obj = evt.getSource();
-
-            if (obj instanceof JRadioButton)  {
-                JRadioButton button = (JRadioButton)obj;
-                if (button == hRadio) {
-                    setMode(HUE_MODE);
-                } else if (button == sRadio) {
-                    setMode(SATURATION_MODE);
-                } else if (button == bRadio) {
-                    setMode(BRIGHTNESS_MODE);
-                }
-            }
-        }
-    }
-
-    private void setMode(int mode) {
-        if (currentMode == mode) {
-            return;
-        }
-
-        isAdjusting = true;  // Ensure no events propagate from changing slider value.
-        currentMode = mode;
-
-        float[] hsb = getHSBColorFromModel();
-
-        switch (currentMode) {
-            case HUE_MODE:
-                slider.setInverted(true);
-                slider.setMaximum(MAX_HUE_VALUE);
-                palette.setValues(HSBImage.HSQUARE, hsb[0], 1.0f, 1.0f);
-                sliderPalette.setValues(HSBImage.HSLIDER, 0f, 1.0f, 1.0f);
-                break;
-            case SATURATION_MODE:
-                slider.setInverted(false);
-                slider.setMaximum(MAX_SATURATION_VALUE);
-                palette.setValues(HSBImage.SSQUARE, hsb[0], hsb[1], 1.0f);
-                sliderPalette.setValues(HSBImage.SSLIDER, hsb[0], 1.0f, 1.0f);
-                break;
-            case BRIGHTNESS_MODE:
-                slider.setInverted(false);
-                slider.setMaximum(MAX_BRIGHTNESS_VALUE);
-                palette.setValues(HSBImage.BSQUARE, hsb[0], 1.0f, hsb[2]);
-                sliderPalette.setValues(HSBImage.BSLIDER, hsb[0], 1.0f, 1.0f);
-                break;
-        }
-
-        isAdjusting = false;
-
-        palette.nextFrame();
-        sliderPalette.nextFrame();
-
-        updateChooser();
-    }
-
-    protected JComponent buildSliderPalettePanel() {
-
-        // This slider has to have a minimum of 0.  A lot of math in this file is simplified due to this.
-        slider = new JSlider(JSlider.VERTICAL, 0, MAX_HUE_VALUE, 0);
-        slider.setInverted(true);
-        slider.setPaintTrack(false);
-        slider.setPreferredSize(new Dimension(slider.getPreferredSize().width, PALETTE_DIMENSION + 15));
-        slider.addChangeListener(this);
-        slider.setInheritsPopupMenu(true);
-        // We're not painting ticks, but need to ask UI classes to
-        // paint arrow shape anyway, if possible.
-        slider.putClientProperty("Slider.paintThumbArrowShape", Boolean.TRUE);
-        paletteLabel = createPaletteLabel();
-        addPaletteListeners();
-        sliderPaletteLabel = new JLabel();
-
-        JPanel panel = new JPanel();
-        panel.add( paletteLabel );
-        panel.add( slider );
-        panel.add( sliderPaletteLabel );
-
-        initializePalettesIfNecessary();
-
-        return panel;
-    }
-
-    private void initializePalettesIfNecessary() {
-        if (palette != null) {
-            return;
-        }
-
-        float[] hsb = getHSBColorFromModel();
-
-        switch(currentMode){
-            case HUE_MODE:
-                palette = new HSBImage(HSBImage.HSQUARE, PALETTE_DIMENSION, PALETTE_DIMENSION, hsb[0], 1.0f, 1.0f);
-                sliderPalette = new HSBImage(HSBImage.HSLIDER, 16, PALETTE_DIMENSION, 0f, 1.0f, 1.0f);
-                break;
-            case SATURATION_MODE:
-                palette = new HSBImage(HSBImage.SSQUARE, PALETTE_DIMENSION, PALETTE_DIMENSION, 1.0f, hsb[1], 1.0f);
-                sliderPalette = new HSBImage(HSBImage.SSLIDER, 16, PALETTE_DIMENSION, 1.0f, 0f, 1.0f);
-                break;
-            case BRIGHTNESS_MODE:
-                palette = new HSBImage(HSBImage.BSQUARE, PALETTE_DIMENSION, PALETTE_DIMENSION, 1.0f, 1.0f, hsb[2]);
-                sliderPalette = new HSBImage(HSBImage.BSLIDER, 16, PALETTE_DIMENSION, 1.0f, 1.0f, 0f);
-                break;
-        }
-        paletteImage = Toolkit.getDefaultToolkit().createImage(palette);
-        sliderPaletteImage = Toolkit.getDefaultToolkit().createImage(sliderPalette);
-
-        paletteLabel.setIcon(new ImageIcon(paletteImage));
-        sliderPaletteLabel.setIcon(new ImageIcon(sliderPaletteImage));
-    }
-
-    private void cleanupPalettesIfNecessary() {
-        if (palette == null) {
-            return;
-        }
-
-        palette.aborted = true;
-        sliderPalette.aborted = true;
-
-        palette.nextFrame();
-        sliderPalette.nextFrame();
-
-        palette = null;
-        sliderPalette = null;
-
-        paletteImage = null;
-        sliderPaletteImage = null;
-
-        paletteLabel.setIcon(null);
-        sliderPaletteLabel.setIcon(null);
-    }
-
-    protected JLabel createPaletteLabel() {
-        return new JLabel() {
-            protected void paintComponent( Graphics g ) {
-                super.paintComponent( g );
-                g.setColor( Color.white );
-                g.drawOval( paletteSelection.x - 4, paletteSelection.y - 4, 8, 8 );
-            }
-        };
-    }
-
-    public String getDisplayName() {
-        return UIManager.getString("ColorChooser.hsbNameText", getLocale());
-    }
-
-    /**
-     * Provides a hint to the look and feel as to the
-     * <code>KeyEvent.VK</code> constant that can be used as a mnemonic to
-     * access the panel. A return value <= 0 indicates there is no mnemonic.
-     * <p>
-     * The return value here is a hint, it is ultimately up to the look
-     * and feel to honor the return value in some meaningful way.
-     * <p>
-     * This implementation looks up the value from the default
-     * <code>ColorChooser.hsbMnemonic</code>, or if it
-     * isn't available (or not an <code>Integer</code>) returns -1.
-     * The lookup for the default is done through the <code>UIManager</code>:
-     * <code>UIManager.get("ColorChooser.rgbMnemonic");</code>.
-     *
-     * @return KeyEvent.VK constant identifying the mnemonic; <= 0 for no
-     *         mnemonic
-     * @see #getDisplayedMnemonicIndex
-     * @since 1.4
-     */
-    public int getMnemonic() {
-        return getInt("ColorChooser.hsbMnemonic", -1);
-    }
-
-    /**
-     * Provides a hint to the look and feel as to the index of the character in
-     * <code>getDisplayName</code> that should be visually identified as the
-     * mnemonic. The look and feel should only use this if
-     * <code>getMnemonic</code> returns a value > 0.
-     * <p>
-     * The return value here is a hint, it is ultimately up to the look
-     * and feel to honor the return value in some meaningful way. For example,
-     * a look and feel may wish to render each
-     * <code>AbstractColorChooserPanel</code> in a <code>JTabbedPane</code>,
-     * and further use this return value to underline a character in
-     * the <code>getDisplayName</code>.
-     * <p>
-     * This implementation looks up the value from the default
-     * <code>ColorChooser.rgbDisplayedMnemonicIndex</code>, or if it
-     * isn't available (or not an <code>Integer</code>) returns -1.
-     * The lookup for the default is done through the <code>UIManager</code>:
-     * <code>UIManager.get("ColorChooser.hsbDisplayedMnemonicIndex");</code>.
-     *
-     * @return Character index to render mnemonic for; -1 to provide no
-     *                   visual identifier for this panel.
-     * @see #getMnemonic
-     * @since 1.4
-     */
-    public int getDisplayedMnemonicIndex() {
-        return getInt("ColorChooser.hsbDisplayedMnemonicIndex", -1);
-    }
-
-    public Icon getSmallDisplayIcon() {
-        return null;
-    }
-
-    public Icon getLargeDisplayIcon() {
-        return null;
-    }
-
-    /**
-     * Class for the slider and palette images.
-     */
-    class HSBImage extends SyntheticImage {
-        protected float h = .0f;
-        protected float s = .0f;
-        protected float b = .0f;
-        protected float[] hsb = new float[3];
-
-        protected boolean isDirty = true;
-        protected int cachedY;
-        protected int cachedColor;
-        protected int type;
-
-        private static final int HSQUARE = 0;
-        private static final int SSQUARE = 1;
-        private static final int BSQUARE = 2;
-        private static final int HSLIDER = 3;
-        private static final int SSLIDER = 4;
-        private static final int BSLIDER = 5;
-
-        protected HSBImage(int type, int width, int height, float h, float s, float b) {
-            super(width, height);
-            setValues(type, h, s, b);
-        }
-
-        public void setValues(int type, float h, float s, float b) {
-            this.type = type;
-            cachedY = -1;
-            cachedColor = 0;
-            setHue( h );
-            setSaturation( s );
-            setBrightness( b );
-        }
-
-        public final void setHue( float hue ) {
-            h = hue;
-        }
-
-        public final void setSaturation( float saturation ) {
-            s = saturation;
-        }
-
-        public final void setBrightness( float brightness ) {
-            b = brightness;
-        }
-
-        public final float getHue() {
-            return h;
-        }
-
-        public final float getSaturation() {
-            return s;
-        }
-
-        public final float getBrightness() {
-            return b;
-        }
-
-        protected boolean isStatic() {
-            return false;
-        }
-
-        public synchronized void nextFrame() {
-            isDirty = true;
-            notifyAll();
-        }
-
-        public synchronized void addConsumer(ImageConsumer ic) {
-            isDirty = true;
-            super.addConsumer(ic);
-        }
-
-        private int getRGBForLocation( int x, int y ) {
-            if (type >= HSLIDER && y == cachedY) {
-                return cachedColor;
-            }
-
-            getHSBForLocation( x, y, hsb );
-            cachedY = y;
-            cachedColor = Color.HSBtoRGB( hsb[0], hsb[1], hsb[2] );
-
-            return cachedColor;
-        }
-
-        public void getHSBForLocation( int x, int y, float[] hsbArray ) {
-            switch (type) {
-                case HSQUARE: {
-                    float saturationStep = ((float)x) / width;
-                    float brightnessStep = ((float)y) / height;
-                    hsbArray[0] = h;
-                    hsbArray[1] = s - saturationStep;
-                    hsbArray[2] = b - brightnessStep;
-                    break;
-                }
-                case SSQUARE: {
-                    float brightnessStep = ((float)y) / height;
-                    float step = 1.0f / ((float)width);
-                    hsbArray[0] = x * step;
-                    hsbArray[1] = s;
-                    hsbArray[2] = 1.0f - brightnessStep;
-                    break;
-                }
-                case BSQUARE: {
-                    float saturationStep = ((float)y) / height;
-                    float step = 1.0f / ((float)width);
-                    hsbArray[0] = x * step;
-                    hsbArray[1] = 1.0f - saturationStep;
-                    hsbArray[2] = b;
-                    break;
-                }
-                case HSLIDER: {
-                    float step = 1.0f / ((float)height);
-                    hsbArray[0] = y * step;
-                    hsbArray[1] = s;
-                    hsbArray[2] = b;
-                    break;
-                }
-                case SSLIDER: {
-                    float saturationStep = ((float)y) / height;
-                    hsbArray[0] = h;
-                    hsbArray[1] = s - saturationStep;
-                    hsbArray[2] = b;
-                    break;
-                }
-                case BSLIDER: {
-                    float brightnessStep = ((float)y) / height;
-                    hsbArray[0] = h;
-                    hsbArray[1] = s;
-                    hsbArray[2] = b - brightnessStep;
-                    break;
-                }
-            }
-        }
-
-        /**
-         * Overriden method from SyntheticImage
-         */
-        protected void computeRow( int y, int[] row ) {
-            if ( y == 0 ) {
-                synchronized ( this ) {
-                    try {
-                        while ( !isDirty ) {
-                            wait();
-                        }
-                    } catch (InterruptedException ie) {
-                    }
-                    isDirty = false;
-                }
-            }
-
-            if (aborted) {
-                return;
-            }
-
-            for ( int i = 0; i < row.length; ++i ) {
-                row[i] = getRGBForLocation( i, y );
-            }
-        }
-    }
-
-    public void stateChanged(ChangeEvent e) {
-        if (e.getSource() == slider) {
-            boolean modelIsAdjusting = slider.getModel().getValueIsAdjusting();
-
-            if (!modelIsAdjusting && !isAdjusting) {
-                int sliderValue = slider.getValue();
-                int sliderRange = slider.getMaximum();
-                float value = (float)sliderValue / (float)sliderRange;
-
-                float[] hsb = getHSBColorFromModel();
-
-                switch ( currentMode ){
-                    case HUE_MODE:
-                        updateHSB(value, hsb[1], hsb[2]);
-                        break;
-                    case SATURATION_MODE:
-                        updateHSB(hsb[0], value, hsb[2]);
-                        break;
-                    case BRIGHTNESS_MODE:
-                        updateHSB(hsb[0], hsb[1], value);
-                        break;
-                }
-            }
-        } else if (e.getSource() instanceof JSpinner) {
-            float hue = ((Integer)hField.getValue()).floatValue() / 359f;
-            float saturation = ((Integer)sField.getValue()).floatValue() / 100f;
-            float brightness = ((Integer)bField.getValue()).floatValue() / 100f;
-
-            updateHSB(hue, saturation, brightness);
-        }
-    }
-
-    public void hierarchyChanged(HierarchyEvent he) {
-        if ((he.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
-            if (isDisplayable()) {
-                initializePalettesIfNecessary();
-            } else {
-                cleanupPalettesIfNecessary();
-            }
-        }
-    }
-
-}
--- a/src/share/classes/javax/swing/colorchooser/DefaultRGBChooserPanel.java	Wed Jul 09 19:29:07 2008 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,294 +0,0 @@
-/*
- * Copyright 1998-2004 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package javax.swing.colorchooser;
-
-import javax.swing.*;
-import javax.swing.event.*;
-import java.awt.*;
-import java.util.Locale;
-
-/**
- * The standard RGB chooser.
- * <p>
- * <strong>Warning:</strong>
- * Serialized objects of this class will not be compatible with
- * future Swing releases. The current serialization support is
- * appropriate for short term storage or RMI between applications running
- * the same version of Swing.  As of 1.4, support for long term storage
- * of all JavaBeans<sup><font size="-2">TM</font></sup>
- * has been added to the <code>java.beans</code> package.
- * Please see {@link java.beans.XMLEncoder}.
- *
- * @author Steve Wilson
- * @author Mark Davidson
- * @see JColorChooser
- * @see AbstractColorChooserPanel
- */
-class DefaultRGBChooserPanel extends AbstractColorChooserPanel implements ChangeListener {
-
-    protected JSlider redSlider;
-    protected JSlider greenSlider;
-    protected JSlider blueSlider;
-    protected JSpinner redField;
-    protected JSpinner blueField;
-    protected JSpinner greenField;
-
-    private final int minValue = 0;
-    private final int maxValue = 255;
-
-    private boolean isAdjusting = false; // indicates the fields are being set internally
-
-    public DefaultRGBChooserPanel() {
-        super();
-        setInheritsPopupMenu(true);
-    }
-
-    /**
-     * Sets the values of the controls to reflect the color
-     */
-    private void setColor( Color newColor ) {
-        int red = newColor.getRed();
-        int blue = newColor.getBlue();
-        int green = newColor.getGreen();
-
-        if (redSlider.getValue() != red) {
-            redSlider.setValue(red);
-        }
-        if (greenSlider.getValue() != green) {
-            greenSlider.setValue(green);
-        }
-        if (blueSlider.getValue() != blue) {
-            blueSlider.setValue(blue);
-        }
-
-        if (((Integer)redField.getValue()).intValue() != red)
-            redField.setValue(new Integer(red));
-        if (((Integer)greenField.getValue()).intValue() != green)
-            greenField.setValue(new Integer(green));
-        if (((Integer)blueField.getValue()).intValue() != blue )
-            blueField.setValue(new Integer(blue));
-    }
-
-    public String getDisplayName() {
-        return UIManager.getString("ColorChooser.rgbNameText", getLocale());
-    }
-
-    /**
-     * Provides a hint to the look and feel as to the
-     * <code>KeyEvent.VK</code> constant that can be used as a mnemonic to
-     * access the panel. A return value <= 0 indicates there is no mnemonic.
-     * <p>
-     * The return value here is a hint, it is ultimately up to the look
-     * and feel to honor the return value in some meaningful way.
-     * <p>
-     * This implementation looks up the value from the default
-     * <code>ColorChooser.rgbMnemonic</code>, or if it
-     * isn't available (or not an <code>Integer</code>) returns -1.
-     * The lookup for the default is done through the <code>UIManager</code>:
-     * <code>UIManager.get("ColorChooser.rgbMnemonic");</code>.
-     *
-     * @return KeyEvent.VK constant identifying the mnemonic; <= 0 for no
-     *         mnemonic
-     * @see #getDisplayedMnemonicIndex
-     * @since 1.4
-     */
-    public int getMnemonic() {
-        return getInt("ColorChooser.rgbMnemonic", -1);
-    }
-
-    /**
-     * Provides a hint to the look and feel as to the index of the character in
-     * <code>getDisplayName</code> that should be visually identified as the
-     * mnemonic. The look and feel should only use this if
-     * <code>getMnemonic</code> returns a value > 0.
-     * <p>
-     * The return value here is a hint, it is ultimately up to the look
-     * and feel to honor the return value in some meaningful way. For example,
-     * a look and feel may wish to render each
-     * <code>AbstractColorChooserPanel</code> in a <code>JTabbedPane</code>,
-     * and further use this return value to underline a character in
-     * the <code>getDisplayName</code>.
-     * <p>
-     * This implementation looks up the value from the default
-     * <code>ColorChooser.rgbDisplayedMnemonicIndex</code>, or if it
-     * isn't available (or not an <code>Integer</code>) returns -1.
-     * The lookup for the default is done through the <code>UIManager</code>:
-     * <code>UIManager.get("ColorChooser.rgbDisplayedMnemonicIndex");</code>.
-     *
-     * @return Character index to render mnemonic for; -1 to provide no
-     *                   visual identifier for this panel.
-     * @see #getMnemonic
-     * @since 1.4
-     */
-    public int getDisplayedMnemonicIndex() {
-        return getInt("ColorChooser.rgbDisplayedMnemonicIndex", -1);
-    }
-
-    public Icon getSmallDisplayIcon() {
-        return null;
-    }
-
-    public Icon getLargeDisplayIcon() {
-        return null;
-    }
-
-    /**
-     * The background color, foreground color, and font are already set to the
-     * defaults from the defaults table before this method is called.
-     */
-    public void installChooserPanel(JColorChooser enclosingChooser) {
-        super.installChooserPanel(enclosingChooser);
-    }
-
-    protected void buildChooser() {
-
-        Locale locale = getLocale();
-        String redString = UIManager.getString("ColorChooser.rgbRedText", locale);
-        String greenString = UIManager.getString("ColorChooser.rgbGreenText", locale);
-        String blueString = UIManager.getString("ColorChooser.rgbBlueText", locale);
-
-        setLayout( new BorderLayout() );
-        Color color = getColorFromModel();
-
-
-        JPanel enclosure = new JPanel();
-        enclosure.setLayout( new SmartGridLayout( 3, 3 ) );
-        enclosure.setInheritsPopupMenu(true);
-
-        // The panel that holds the sliders
-
-        add( enclosure, BorderLayout.CENTER );
-        //        sliderPanel.setBorder(new LineBorder(Color.black));
-
-        // The row for the red value
-        JLabel l = new JLabel(redString);
-        l.setDisplayedMnemonic(getInt("ColorChooser.rgbRedMnemonic", -1));
-        enclosure.add(l);
-        redSlider = new JSlider(JSlider.HORIZONTAL, 0, 255, color.getRed());
-        redSlider.setMajorTickSpacing( 85 );
-        redSlider.setMinorTickSpacing( 17 );
-        redSlider.setPaintTicks( true );
-        redSlider.setPaintLabels( true );
-        redSlider.setInheritsPopupMenu(true);
-        enclosure.add( redSlider );
-        redField = new JSpinner(
-            new SpinnerNumberModel(color.getRed(), minValue, maxValue, 1));
-        l.setLabelFor(redSlider);
-        redField.setInheritsPopupMenu(true);
-        JPanel redFieldHolder = new JPanel(new CenterLayout());
-        redFieldHolder.setInheritsPopupMenu(true);
-        redField.addChangeListener(this);
-        redFieldHolder.add(redField);
-        enclosure.add(redFieldHolder);
-
-
-        // The row for the green value
-        l = new JLabel(greenString);
-        l.setDisplayedMnemonic(getInt("ColorChooser.rgbGreenMnemonic", -1));
-        enclosure.add(l);
-        greenSlider = new JSlider(JSlider.HORIZONTAL, 0, 255, color.getGreen());
-        greenSlider.setMajorTickSpacing( 85 );
-        greenSlider.setMinorTickSpacing( 17 );
-        greenSlider.setPaintTicks( true );
-        greenSlider.setPaintLabels( true );
-        greenSlider.setInheritsPopupMenu(true);
-        enclosure.add(greenSlider);
-        greenField = new JSpinner(
-            new SpinnerNumberModel(color.getGreen(), minValue, maxValue, 1));
-        l.setLabelFor(greenSlider);
-        greenField.setInheritsPopupMenu(true);
-        JPanel greenFieldHolder = new JPanel(new CenterLayout());
-        greenFieldHolder.add(greenField);
-        greenFieldHolder.setInheritsPopupMenu(true);
-        greenField.addChangeListener(this);
-        enclosure.add(greenFieldHolder);
-
-        // The slider for the blue value
-        l = new JLabel(blueString);
-        l.setDisplayedMnemonic(getInt("ColorChooser.rgbBlueMnemonic", -1));
-        enclosure.add(l);
-        blueSlider = new JSlider(JSlider.HORIZONTAL, 0, 255, color.getBlue());
-        blueSlider.setMajorTickSpacing( 85 );
-        blueSlider.setMinorTickSpacing( 17 );
-        blueSlider.setPaintTicks( true );
-        blueSlider.setPaintLabels( true );
-        blueSlider.setInheritsPopupMenu(true);
-        enclosure.add(blueSlider);
-        blueField = new JSpinner(
-            new SpinnerNumberModel(color.getBlue(), minValue, maxValue, 1));
-        l.setLabelFor(blueSlider);
-        blueField.setInheritsPopupMenu(true);
-        JPanel blueFieldHolder = new JPanel(new CenterLayout());
-        blueFieldHolder.add(blueField);
-        blueField.addChangeListener(this);
-        blueFieldHolder.setInheritsPopupMenu(true);
-        enclosure.add(blueFieldHolder);
-
-        redSlider.addChangeListener( this );
-        greenSlider.addChangeListener( this );
-        blueSlider.addChangeListener( this );
-
-        redSlider.putClientProperty("JSlider.isFilled", Boolean.TRUE);
-        greenSlider.putClientProperty("JSlider.isFilled", Boolean.TRUE);
-        blueSlider.putClientProperty("JSlider.isFilled", Boolean.TRUE);
-    }
-
-    public void uninstallChooserPanel(JColorChooser enclosingChooser) {
-        super.uninstallChooserPanel(enclosingChooser);
-        removeAll();
-    }
-
-    public void updateChooser() {
-        if (!isAdjusting) {
-            isAdjusting = true;
-
-            setColor(getColorFromModel());
-
-            isAdjusting = false;
-        }
-    }
-
-    public void stateChanged( ChangeEvent e ) {
-        if ( e.getSource() instanceof JSlider && !isAdjusting) {
-
-            int red = redSlider.getValue();
-            int green = greenSlider.getValue();
-            int blue = blueSlider.getValue() ;
-            Color color = new Color (red, green, blue);
-
-            getColorSelectionModel().setSelectedColor(color);
-        } else if (e.getSource() instanceof JSpinner && !isAdjusting) {
-
-            int red = ((Integer)redField.getValue()).intValue();
-            int green = ((Integer)greenField.getValue()).intValue();
-            int blue = ((Integer)blueField.getValue()).intValue();
-            Color color = new Color (red, green, blue);
-
-            getColorSelectionModel().setSelectedColor(color);
-        }
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/swing/colorchooser/DiagramComponent.java	Fri Jul 18 18:26:22 2008 +0400
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.swing.colorchooser;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.image.BufferedImage;
+import javax.swing.JComponent;
+
+final class DiagramComponent extends JComponent implements MouseListener, MouseMotionListener {
+
+    private final ColorPanel panel;
+    private final boolean diagram;
+
+    private final Insets insets = new Insets(0, 0, 0, 0);
+
+    private int width;
+    private int height;
+
+    private int[] array;
+    private BufferedImage image;
+
+    DiagramComponent(ColorPanel panel, boolean diagram) {
+        this.panel = panel;
+        this.diagram = diagram;
+        addMouseListener(this);
+        addMouseMotionListener(this);
+    }
+
+    @Override
+    protected void paintComponent(Graphics g) {
+        getInsets(this.insets);
+        this.width = getWidth() - this.insets.left - this.insets.right;
+        this.height = getHeight() - this.insets.top - this.insets.bottom;
+
+        boolean update = (this.image == null)
+                || (this.width != this.image.getWidth())
+                || (this.height != this.image.getHeight());
+        if (update) {
+            int size = this.width * this.height;
+            if ((this.array == null) || (this.array.length < size)) {
+                this.array = new int[size];
+            }
+            this.image = new BufferedImage(this.width, this.height, BufferedImage.TYPE_INT_RGB);
+        }
+        {
+            float dx = 1.0f / (float) (this.width - 1);
+            float dy = 1.0f / (float) (this.height - 1);
+
+            int offset = 0;
+            float y = 0.0f;
+            for (int h = 0; h < this.height; h++, y += dy) {
+                if (this.diagram) {
+                    float x = 0.0f;
+                    for (int w = 0; w < this.width; w++, x += dx, offset++) {
+                        this.array[offset] = this.panel.getColor(x, y);
+                    }
+                }
+                else {
+                    int color = this.panel.getColor(y);
+                    for (int w = 0; w < this.width; w++, offset++) {
+                        this.array[offset] = color;
+                    }
+                }
+            }
+        }
+        this.image.setRGB(0, 0, this.width, this.height, this.array, 0, this.width);
+        g.drawImage(this.image, this.insets.left, this.insets.top, this.width, this.height, this);
+        if (isEnabled()) {
+            this.width--;
+            this.height--;
+            g.setXORMode(Color.WHITE);
+            g.setColor(Color.BLACK);
+            if (this.diagram) {
+                int x = getValue(this.panel.getValueX(), this.insets.left, this.width);
+                int y = getValue(this.panel.getValueY(), this.insets.top, this.height);
+                g.drawLine(x - 8, y, x + 8, y);
+                g.drawLine(x, y - 8, x, y + 8);
+            }
+            else {
+                int z = getValue(this.panel.getValueZ(), this.insets.top, this.height);
+                g.drawLine(this.insets.left, z, this.insets.left + this.width, z);
+            }
+            g.setPaintMode();
+        }
+    }
+
+    public void mousePressed(MouseEvent event) {
+        mouseDragged(event);
+    }
+
+    public void mouseReleased(MouseEvent event) {
+    }
+
+    public void mouseClicked(MouseEvent event) {
+    }
+
+    public void mouseEntered(MouseEvent event) {
+    }
+
+    public void mouseExited(MouseEvent event) {
+    }
+
+    public void mouseMoved(MouseEvent event) {
+    }
+
+    public void mouseDragged(MouseEvent event) {
+        if (isEnabled()) {
+            float y = getValue(event.getY(), this.insets.top, this.height);
+            if (this.diagram) {
+                float x = getValue(event.getX(), this.insets.left, this.width);
+                this.panel.setValue(x, y);
+            }
+            else {
+                this.panel.setValue(y);
+            }
+        }
+    }
+
+    private static int getValue(float value, int min, int max) {
+        return min + (int) (value * (float) (max));
+    }
+
+    private static float getValue(int value, int min, int max) {
+        if (min < value) {
+            value -= min;
+            return (value < max)
+                    ? (float) value / (float) max
+                    : 1.0f;
+        }
+        return 0.0f;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/swing/colorchooser/SlidingSpinner.java	Fri Jul 18 18:26:22 2008 +0400
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.swing.colorchooser;
+
+import javax.swing.JComponent;
+import javax.swing.JSlider;
+import javax.swing.JSpinner;
+import javax.swing.JSpinner.DefaultEditor;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+final class SlidingSpinner implements ChangeListener {
+
+    private final ColorPanel panel;
+    private final JComponent label;
+    private final SpinnerNumberModel model = new SpinnerNumberModel();
+    private final JSlider slider = new JSlider();
+    private final JSpinner spinner = new JSpinner(this.model);
+    private float value;
+    private boolean internal;
+
+    SlidingSpinner(ColorPanel panel, JComponent label) {
+        this.panel = panel;
+        this.label = label;
+        this.slider.addChangeListener(this);
+        this.spinner.addChangeListener(this);
+        DefaultEditor editor = (DefaultEditor) this.spinner.getEditor();
+        ValueFormatter.init(3, false, editor.getTextField());
+        editor.setFocusable(false);
+        this.spinner.setFocusable(false);
+    }
+
+    JComponent getLabel() {
+        return this.label;
+    }
+
+    JSlider getSlider() {
+        return this.slider;
+    }
+
+    JSpinner getSpinner() {
+        return this.spinner;
+    }
+
+    float getValue() {
+        return this.value;
+    }
+
+    void setValue(float value) {
+        int min = this.slider.getMinimum();
+        int max = this.slider.getMaximum();
+        this.internal = true;
+        this.slider.setValue(min + (int) (value * (float) (max - min)));
+        this.spinner.setValue(Integer.valueOf(this.slider.getValue()));
+        this.internal = false;
+        this.value = value;
+    }
+
+    void setRange(int min, int max) {
+        this.internal = true;
+        this.slider.setMinimum(min);
+        this.slider.setMaximum(max);
+        this.model.setMinimum(Integer.valueOf(min));
+        this.model.setMaximum(Integer.valueOf(max));
+        this.internal = false;
+    }
+
+    void setVisible(boolean visible) {
+        this.label.setVisible(visible);
+        this.slider.setVisible(visible);
+        this.spinner.setVisible(visible);
+    }
+
+    public void stateChanged(ChangeEvent event) {
+        if (!this.internal) {
+            if (this.spinner == event.getSource()) {
+                Object value = this.spinner.getValue();
+                if (value instanceof Integer) {
+                    this.internal = true;
+                    this.slider.setValue((Integer) value);
+                    this.internal = false;
+                }
+            }
+            int value = this.slider.getValue();
+            this.internal = true;
+            this.spinner.setValue(Integer.valueOf(value));
+            this.internal = false;
+            int min = this.slider.getMinimum();
+            int max = this.slider.getMaximum();
+            this.value = (float) (value - min) / (float) (max - min);
+            this.panel.colorChanged();
+        }
+    }
+}
--- a/src/share/classes/javax/swing/colorchooser/SyntheticImage.java	Wed Jul 09 19:29:07 2008 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-/*
- * Copyright 1997-2003 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package javax.swing.colorchooser;
-
-import java.awt.*;
-import java.awt.image.*;
-
-/** A helper class to make computing synthetic images a little easier.
- *  All you need to do is define a subclass that overrides computeRow
- *  to compute a row of the image.  It is passed the y coordinate of the
- *  row and an array into which to put the pixels in
- *  <a href="http://java.sun.com/products/jdk/1.1/docs/api/java.awt.image.ColorModel.html#getRGBdefault()">
- *  standard ARGB format</a>.
- *  <p>Normal usage looks something like this:
- *  <pre>&nbsp;Image i = createImage(new SyntheticImage(200, 100) {
- *  &nbsp;    protected void computeRow(int y, int[] row) {
- *  &nbsp;      for(int i = width; --i>=0; ) {
- *  &nbsp;          int grey = i*255/(width-1);
- *  &nbsp;          row[i] = (255<<24)|(grey<<16)|(grey<<8)|grey;
- *  &nbsp;      }
- *  &nbsp;    }
- *  &nbsp;}
- *  </pre>This creates a image 200 pixels wide and 100 pixels high
- *  that is a horizontal grey ramp, going from black on the left to
- *  white on the right.
- *  <p>
- *  If the image is to be a movie, override isStatic to return false,
- *  <i>y</i> cycling back to 0 is computeRow's signal that the next
- *  frame has started.  It is acceptable (expected?) for computeRow(0,r)
- *  to pause until the appropriate time to start the next frame.
- *
- *  @author James Gosling
- */
-abstract class SyntheticImage implements ImageProducer {
-    private SyntheticImageGenerator root;
-    protected int width=10, height=100;
-    static final ColorModel cm = ColorModel.getRGBdefault();
-    public static final int pixMask = 0xFF;
-    private Thread runner;
-    protected SyntheticImage() {    }
-    protected SyntheticImage(int w, int h) { width = w; height = h; }
-    protected void computeRow(int y, int[] row) {
-        int p = 255-255*y/(height-1);
-        p = (pixMask<<24)|(p<<16)|(p<<8)|p;
-        for (int i = row.length; --i>=0; ) row[i] = p;
-    }
-    public synchronized void addConsumer(ImageConsumer ic){
-        for (SyntheticImageGenerator ics = root; ics != null; ics = ics.next)
-            if (ics.ic == ic) return;
-        root = new SyntheticImageGenerator(ic, root, this);
-    }
-    public synchronized boolean isConsumer(ImageConsumer ic){
-        for (SyntheticImageGenerator ics = root; ics != null; ics = ics.next)
-            if (ics.ic == ic) return true;
-        return false;
-    }
-    public synchronized void removeConsumer(ImageConsumer ic) {
-        SyntheticImageGenerator prev = null;
-        for (SyntheticImageGenerator ics = root; ics != null; ics = ics.next) {
-            if (ics.ic == ic) {
-                ics.useful = false;
-                if (prev!=null) prev.next = ics.next;
-                else root = ics.next;
-                return;
-            }
-            prev = ics;
-        }
-    }
-    public synchronized void startProduction(ImageConsumer ic) {
-        addConsumer(ic);
-        for (SyntheticImageGenerator ics = root; ics != null; ics = ics.next)
-            if (ics.useful && !ics.isAlive())
-                ics.start();
-    }
-    protected boolean isStatic() { return true; }
-    public void nextFrame(int param) {}//Override if !isStatic
-    public void requestTopDownLeftRightResend(ImageConsumer ic){}
-
-    protected volatile boolean aborted = false;
-}
-
-class SyntheticImageGenerator extends Thread {
-    ImageConsumer ic;
-    boolean useful;
-    SyntheticImageGenerator next;
-    SyntheticImage parent;
-    SyntheticImageGenerator(ImageConsumer ic, SyntheticImageGenerator next,
-        SyntheticImage parent) {
-        super("SyntheticImageGenerator");
-        this.ic = ic;
-        this.next = next;
-        this.parent = parent;
-        useful = true;
-        setDaemon(true);
-    }
-    public void run() {
-        ImageConsumer ic = this.ic;
-        int w = parent.width;
-        int h = parent.height;
-        int hints = ic.SINGLEPASS|ic.COMPLETESCANLINES|ic.TOPDOWNLEFTRIGHT;
-        if (parent.isStatic())
-            hints |= ic.SINGLEFRAME;
-        ic.setHints(hints);
-        ic.setDimensions(w, h);
-        ic.setProperties(null);
-        ic.setColorModel(parent.cm);
-
-        if (useful) {
-            int[] row=new int[w];
-            doPrivileged( new Runnable() {
-                public void run() {
-                    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
-                }
-            });
-
-            do {
-                for (int y = 0; y<h && useful; y++) {
-                    parent.computeRow(y,row);
-
-                    if (parent.aborted) {
-                        ic.imageComplete(ic.IMAGEABORTED);
-                        return;
-                    }
-
-                    ic.setPixels(0, y, w, 1, parent.cm, row, 0, w);
-                }
-                ic.imageComplete(parent.isStatic() ? ic.STATICIMAGEDONE
-                                            : ic.SINGLEFRAMEDONE );
-            } while(!parent.isStatic() && useful);
-        }
-    }
-
-    private final static void doPrivileged(final Runnable doRun) {
-        java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
-                public Object run() {
-                  doRun.run();
-                  return null;
-                }
-            }
-        );
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/swing/colorchooser/ValueFormatter.java	Fri Jul 18 18:26:22 2008 +0400
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.swing.colorchooser;
+
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.text.ParseException;
+import static java.util.Locale.ENGLISH;
+import javax.swing.JFormattedTextField;
+import javax.swing.JFormattedTextField.AbstractFormatter;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultFormatterFactory;
+import javax.swing.text.DocumentFilter;
+
+final class ValueFormatter extends AbstractFormatter implements FocusListener, Runnable {
+
+    static void init(int length, boolean hex, JFormattedTextField text) {
+        ValueFormatter formatter = new ValueFormatter(length, hex);
+        text.setColumns(length);
+        text.setFormatterFactory(new DefaultFormatterFactory(formatter));
+        text.setHorizontalAlignment(SwingConstants.RIGHT);
+        text.setMinimumSize(text.getPreferredSize());
+        text.addFocusListener(formatter);
+    }
+
+    private final DocumentFilter filter = new DocumentFilter() {
+        @Override
+        public void remove(FilterBypass fb, int offset, int length) throws BadLocationException {
+            if (isValid(fb.getDocument().getLength() - length)) {
+                fb.remove(offset, length);
+            }
+        }
+
+        @Override
+        public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet set) throws BadLocationException {
+            if (isValid(fb.getDocument().getLength() + text.length() - length) && isValid(text)) {
+                fb.replace(offset, length, text.toUpperCase(ENGLISH), set);
+            }
+        }
+
+        @Override
+        public void insertString(FilterBypass fb, int offset, String text, AttributeSet set) throws BadLocationException {
+            if (isValid(fb.getDocument().getLength() + text.length()) && isValid(text)) {
+                fb.insertString(offset, text.toUpperCase(ENGLISH), set);
+            }
+        }
+    };
+
+    private final int length;
+    private final int radix;
+
+    private JFormattedTextField text;
+
+    ValueFormatter(int length, boolean hex) {
+        this.length = length;
+        this.radix = hex ? 16 : 10;
+    }
+
+    @Override
+    public Object stringToValue(String text) throws ParseException {
+        try {
+            return Integer.valueOf(text, this.radix);
+        }
+        catch (NumberFormatException nfe) {
+            ParseException pe = new ParseException("illegal format", 0);
+            pe.initCause(nfe);
+            throw pe;
+        }
+    }
+
+    @Override
+    public String valueToString(Object object) throws ParseException {
+        if (object instanceof Integer) {
+            if (this.radix == 10) {
+                return object.toString();
+            }
+            int value = (Integer) object;
+            int index = this.length;
+            char[] array = new char[index];
+            while (0 < index--) {
+                array[index] = Character.forDigit(value & 0x0F, this.radix);
+                value >>= 4;
+            }
+            return new String(array).toUpperCase(ENGLISH);
+        }
+        throw new ParseException("illegal object", 0);
+    }
+
+    @Override
+    protected DocumentFilter getDocumentFilter() {
+        return this.filter;
+    }
+
+    public void focusGained(FocusEvent event) {
+        Object source = event.getSource();
+        if (source instanceof JFormattedTextField) {
+            this.text = (JFormattedTextField) source;
+            SwingUtilities.invokeLater(this);
+        }
+    }
+
+    public void focusLost(FocusEvent event) {
+    }
+
+    public void run() {
+        if (this.text != null) {
+            this.text.selectAll();
+        }
+    }
+
+    private boolean isValid(int length) {
+        return (0 <= length) && (length <= this.length);
+    }
+
+    private boolean isValid(String text) {
+        int length = text.length();
+        for (int i = 0; i < length; i++) {
+            char ch = text.charAt(i);
+            if (Character.digit(ch, this.radix) < 0) {
+                return false;
+            }
+        }
+        return true;
+    }
+}
--- a/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java	Wed Jul 09 19:29:07 2008 +0400
+++ b/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java	Fri Jul 18 18:26:22 2008 +0400
@@ -299,8 +299,10 @@
                         tabbedPane.addTab(name, centerWrapper);
                         if (mnemonic > 0) {
                             tabbedPane.setMnemonicAt(i, mnemonic);
-                            tabbedPane.setDisplayedMnemonicIndexAt(
-                                  i, newPanels[i].getDisplayedMnemonicIndex());
+                            int index = newPanels[i].getDisplayedMnemonicIndex();
+                            if (index >= 0) {
+                                tabbedPane.setDisplayedMnemonicIndexAt(i, index);
+                            }
                         }
                     }
                 }
--- a/test/javax/swing/JColorChooser/Test6524757.java	Wed Jul 09 19:29:07 2008 +0400
+++ b/test/javax/swing/JColorChooser/Test6524757.java	Fri Jul 18 18:26:22 2008 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,14 +34,13 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
-import javax.swing.JButton;
+import javax.swing.AbstractButton;
 import javax.swing.JColorChooser;
 import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
-import javax.swing.JRadioButton;
 import javax.swing.UIManager;
 import javax.swing.WindowConstants;
 import javax.swing.colorchooser.AbstractColorChooserPanel;
@@ -59,31 +58,41 @@
 
             "ColorChooser.swatchesNameText", // NON-NLS: string key from DefaultSwatchChooserPanel
             "ColorChooser.swatchesMnemonic", // NON-NLS: string key from DefaultSwatchChooserPanel:int
-            "ColorChooser.swatchesDisplayedMnemonicIndex", // NON-NLS: int key from DefaultSwatchChooserPanel
             "ColorChooser.swatchesSwatchSize", // NON-NLS: dimension key from DefaultSwatchChooserPanel
             "ColorChooser.swatchesRecentText", // NON-NLS: string key from DefaultSwatchChooserPanel
             "ColorChooser.swatchesRecentSwatchSize", // NON-NLS: dimension key from DefaultSwatchChooserPanel
 //NotAvail: "ColorChooser.swatchesDefaultRecentColor", // NON-NLS: color key from DefaultSwatchChooserPanel
 
-            "ColorChooser.hsbNameText", // NON-NLS: string key from DefaultHSBChooserPanel
-            "ColorChooser.hsbMnemonic", // NON-NLS: int key from DefaultHSBChooserPanel
-            "ColorChooser.hsbDisplayedMnemonicIndex", // NON-NLS: int key from DefaultHSBChooserPanel
-            "ColorChooser.hsbHueText", // NON-NLS: string key from DefaultHSBChooserPanel
-            "ColorChooser.hsbSaturationText", // NON-NLS: string key from DefaultHSBChooserPanel
-            "ColorChooser.hsbBrightnessText", // NON-NLS: string key from DefaultHSBChooserPanel
-            "ColorChooser.hsbRedText", // NON-NLS: string key from DefaultHSBChooserPanel
-            "ColorChooser.hsbGreenText", // NON-NLS: string key from DefaultHSBChooserPanel
-            "ColorChooser.hsbBlueText", // NON-NLS: string key from DefaultHSBChooserPanel
+            "ColorChooser.hsvNameText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.hsvMnemonic", // NON-NLS: int key from HSV ColorChooserPanel
+            "ColorChooser.hsvHueText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.hsvSaturationText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.hsvValueText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.hsvTransparencyText", // NON-NLS: string key from HSV ColorChooserPanel
 
-            "ColorChooser.rgbNameText", // NON-NLS: string key from DefaultRGBChooserPanel
-            "ColorChooser.rgbMnemonic", // NON-NLS: int key from DefaultRGBChooserPanel
-            "ColorChooser.rgbDisplayedMnemonicIndex", // NON-NLS: int key from DefaultRGBChooserPanel
-            "ColorChooser.rgbRedText", // NON-NLS: string key from DefaultRGBChooserPanel
-            "ColorChooser.rgbGreenText", // NON-NLS: string key from DefaultRGBChooserPanel
-            "ColorChooser.rgbBlueText", // NON-NLS: string key from DefaultRGBChooserPanel
-            "ColorChooser.rgbRedMnemonic", // NON-NLS: int key from DefaultRGBChooserPanel
-            "ColorChooser.rgbGreenMnemonic", // NON-NLS: int key from DefaultRGBChooserPanel
-            "ColorChooser.rgbBlueMnemonic", // NON-NLS: int key from DefaultRGBChooserPanel
+            "ColorChooser.hslNameText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.hslMnemonic", // NON-NLS: int key from HSV ColorChooserPanel
+            "ColorChooser.hslHueText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.hslSaturationText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.hslLightnessText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.hslTransparencyText", // NON-NLS: string key from HSV ColorChooserPanel
+
+            "ColorChooser.rgbNameText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.rgbMnemonic", // NON-NLS: int key from HSV ColorChooserPanel
+            "ColorChooser.rgbRedText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.rgbGreenText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.rgbBlueText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.rgbAlphaText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.rgbHexCodeText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.rgbHexCodeMnemonic", // NON-NLS: int key from HSV ColorChooserPanel
+
+            "ColorChooser.cmykNameText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.cmykMnemonic", // NON-NLS: int key from HSV ColorChooserPanel
+            "ColorChooser.cmykCyanText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.cmykMagentaText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.cmykYellowText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.cmykBlackText", // NON-NLS: string key from HSV ColorChooserPanel
+            "ColorChooser.cmykAlphaText", // NON-NLS: string key from HSV ColorChooserPanel
     };
     private static final Object[] KOREAN = convert(Locale.KOREAN, KEYS);
     private static final Object[] FRENCH = convert(Locale.FRENCH, KEYS);
@@ -91,19 +100,15 @@
     public static void main(String[] args) {
         // it affects Swing because it is not initialized
         Locale.setDefault(Locale.KOREAN);
-        Object[] korean = create();
+        validate(KOREAN, create());
 
         // it does not affect Swing because it is initialized
         Locale.setDefault(Locale.CANADA);
-        Object[] canada = create();
+        validate(KOREAN, create());
 
         // it definitely should affect Swing
         JComponent.setDefaultLocale(Locale.FRENCH);
-        Object[] french = create();
-
-        validate(KOREAN, korean);
-        validate(KOREAN, canada);
-        validate(FRENCH, french);
+        validate(FRENCH, create());
     }
 
     private static void validate(Object[] expected, Object[] actual) {
@@ -153,10 +158,47 @@
 
         // process all values
         List<Object> list = new ArrayList<Object>(KEYS.length);
-        addMain(list, dialog);
-        addSwatch(list, chooser);
-        addHSB(list, chooser);
-        addRGB(list, chooser);
+
+        Component component = getC(getC(dialog.getLayeredPane(), 0), 1);
+        AbstractButton ok = (AbstractButton) getC(component, 0);
+        AbstractButton cancel = (AbstractButton) getC(component, 1);
+        AbstractButton reset = (AbstractButton) getC(component, 2);
+        list.add(ok.getText());
+        list.add(cancel.getText());
+        list.add(reset.getText());
+        list.add(Integer.valueOf(reset.getMnemonic()));
+
+        for (int i = 0; i < 5; i++) {
+            AbstractColorChooserPanel panel = (AbstractColorChooserPanel) getC(getC(getC(chooser, 0), i), 0);
+            list.add(panel.getDisplayName());
+            list.add(Integer.valueOf(panel.getMnemonic()));
+            if (i == 0) {
+                JLabel label = (JLabel) getC(getC(panel, 0), 1);
+                JPanel upper = (JPanel) getC(getC(getC(panel, 0), 0), 0);
+                JPanel lower = (JPanel) getC(getC(getC(panel, 0), 2), 0);
+                addSize(list, upper, 1, 1, 31, 9);
+                list.add(label.getText());
+                addSize(list, lower, 1, 1, 5, 7);
+            }
+            else {
+                Component container = getC(panel, 0);
+                for (int j = 0; j < 3; j++) {
+                    AbstractButton button = (AbstractButton) getC(container, j);
+                    list.add(button.getText());
+                }
+                JLabel label = (JLabel) getC(container, 3);
+                list.add(label.getText());
+                if (i == 4) {
+                    label = (JLabel) getC(container, 4);
+                    list.add(label.getText());
+                }
+                if (i == 3) {
+                    label = (JLabel) getC(panel, 1);
+                    list.add(label.getText());
+                    list.add(Integer.valueOf(label.getDisplayedMnemonic()));
+                }
+            }
+        }
 
         // close dialog
         dialog.setVisible(false);
@@ -169,56 +211,6 @@
         return list.toArray();
     }
 
-    private static void addMain(List<Object> list, JDialog dialog) {
-        Component component = getC(getC(dialog.getLayeredPane(), 0), 1);
-        JButton ok = (JButton) getC(component, 0);
-        JButton cancel = (JButton) getC(component, 1);
-        JButton reset = (JButton) getC(component, 2);
-        list.add(ok.getText());
-        list.add(cancel.getText());
-        list.add(reset.getText());
-        list.add(Integer.valueOf(reset.getMnemonic()));
-    }
-
-    private static void addSwatch(List<Object> list, JColorChooser chooser) {
-        Component component = addPanel(list, chooser, 0);
-        JLabel label = (JLabel) getC(getC(component, 0), 1);
-        JPanel upper = (JPanel) getC(getC(getC(component, 0), 0), 0);
-        JPanel lower = (JPanel) getC(getC(getC(component, 0), 2), 0);
-        addSize(list, upper, 1, 1, 31, 9);
-        list.add(label.getText());
-        addSize(list, lower, 1, 1, 5, 7);
-    }
-
-    private static void addHSB(List<Object> list, JColorChooser chooser) {
-        Component component = addPanel(list, chooser, 1);
-        JRadioButton h = (JRadioButton) getC(getC(getC(component, 1), 0), 0);
-        JRadioButton s = (JRadioButton) getC(getC(getC(component, 1), 0), 2);
-        JRadioButton b = (JRadioButton) getC(getC(getC(component, 1), 0), 4);
-        list.add(h.getText());
-        list.add(s.getText());
-        list.add(b.getText());
-        JLabel red = (JLabel) getC(getC(getC(component, 1), 2), 0);
-        JLabel green = (JLabel) getC(getC(getC(component, 1), 2), 2);
-        JLabel blue = (JLabel) getC(getC(getC(component, 1), 2), 4);
-        list.add(red.getText());
-        list.add(green.getText());
-        list.add(blue.getText());
-    }
-
-    private static void addRGB(List<Object> list, JColorChooser chooser) {
-        Component component = addPanel(list, chooser, 2);
-        JLabel red = (JLabel) getC(getC(component, 0), 0);
-        JLabel green = (JLabel) getC(getC(component, 0), 3);
-        JLabel blue = (JLabel) getC(getC(component, 0), 6);
-        list.add(red.getText());
-        list.add(green.getText());
-        list.add(blue.getText());
-        list.add(Integer.valueOf(red.getDisplayedMnemonic()));
-        list.add(Integer.valueOf(green.getDisplayedMnemonic()));
-        list.add(Integer.valueOf(blue.getDisplayedMnemonic()));
-    }
-
     private static void addSize(List<Object> list, Component component, int x, int y, int w, int h) {
         Dimension size = component.getPreferredSize();
         int width = (size.width + 1) / w - x;
@@ -226,14 +218,6 @@
         list.add(new Dimension(width, height));
     }
 
-    private static Component addPanel(List<Object> list, JColorChooser chooser, int index) {
-        AbstractColorChooserPanel panel = (AbstractColorChooserPanel) getC(getC(getC(chooser, 0), index), 0);
-        list.add(panel.getDisplayName());
-        list.add(Integer.valueOf(panel.getMnemonic()));
-        list.add(Integer.valueOf(panel.getDisplayedMnemonicIndex()));
-        return panel;
-    }
-
     private static Component getC(Component component, int index) {
         Container container = (Container) component;
         return container.getComponent(index);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JColorChooser/Test6559154.java	Fri Jul 18 18:26:22 2008 +0400
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6559154
+ * @summary Tests EDT hanging
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.JColorChooser;
+import javax.swing.JDialog;
+import javax.swing.SwingUtilities;
+import javax.swing.Timer;
+
+public class Test6559154 implements ActionListener, Runnable {
+
+    private JDialog dialog;
+
+    public void actionPerformed(ActionEvent event) {
+        if (this.dialog != null) {
+            this.dialog.dispose();
+        }
+    }
+
+    public void run() {
+        Timer timer = new Timer(1000, this);
+        timer.setRepeats(false);
+        timer.start();
+
+        JColorChooser chooser = new JColorChooser();
+        setEnabledRecursive(chooser, false);
+
+        this.dialog = new JDialog();
+        this.dialog.add(chooser);
+        this.dialog.setVisible(true);
+    }
+
+    private static void setEnabledRecursive(Container container, boolean enabled) {
+        for (Component component : container.getComponents()) {
+            component.setEnabled(enabled);
+            if (component instanceof Container) {
+                setEnabledRecursive((Container) component, enabled);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Test6559154());
+    }
+}