Skip to main content

It is time to choose Color

Posted by malenkov on December 19, 2007 at 10:09 AM PST

I would like to discuss some proposed changes in the JColorChooser component.

At present, the JColorChooser component contains the following default tabs:

* Swatches: the predefined set of colors

* HSB: color selection defined by hue, saturation, and brightness using a diagram

* RGB: color selection defined by its constituents (Red, Green, and Blue) using a slider

My suggestion is to combine the last two tabs into a one. The proposed color selection approach applies the color diagram from the second tab, but enables using several color models: HSV, HSL, RGB, and CMYK.

Test diagram is available for the following L&Fs: system, metal, and motif.

This tab has been developed for the 6552812 CR. However, I think that it is an improper solution to add a new tab which looks exactly the same as a previous one. That is why I decided to combine the HSV and HSL color spaces. Moreover, I added the means to select the RGB color in the same diagram. What do you think about this integration? Do we need several separate tabs for each color model? Do you like the existing RGB tab?

Additionally, I developed CMYK support. However, this model consists of four constituents: cyan, magenta, yellow, and key (black), which are hardly laid out on a 3D diagram. Should I leave it as is, use CMY instead, or it will be better to remove CMYK at all?

Personally, I prefer not to use a slider, because we cannot identify the exact position the slider points to. Applying the Motif L&F we may notice that the slider center does not coincide with line pointer on the extreme values. Do you really need the slider? My new tab fixes rendering of this slider in Windows Vista that is described in the 6579827 CR. However, I would like to remove the slider, because the new component enables mouse selection and possesses an accurate pointer. What kind of pointer would you prefer? Why?

Let's review the design. The above screenshots show different means of color selection on the diagram. While I prefer the large dagger, other reviewers would like to see the current color in the dagger's center. Additionally, I can use a simple circle, as before. What is your choice? Why?

What is your opinion on the joining up the text fields in groups? Would it be better to remove the title border and use a simple label above the first field instead? Should we use the border around the diagram?

New implementation of the diagram rendering uses the BufferedImage class recommended by Java2D team. This technique is considered more stable than implementation of the ImageProducer interface, because it enables us to solve the problem described in the 6417055 CR.

Your feedbacks and comments will be greatly appreciated!

Related Topics >>