RFR: 8358023: javafx.scene.control.ColorPicker configure size of squares in color pallet

Kevin Rushforth kcr at openjdk.org
Mon Nov 3 20:37:50 UTC 2025


On Mon, 3 Nov 2025 18:43:14 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

> This is a good question. We already have a can of worms on our hands, so we need to figure out what to do with it.

You are right.

In this specific case, we have many color picker skin properties in `modena.css` and none are documented. The only thing about the skin that is documented is this, from the CSS guide:


Substructure

    color display node — Label
    arrow-button — StackPane
        arrow — StackPane


Nothing at all about the popup or the palette.

> First of all, we should decide (speaking generally) what properties should be in the control, to be applied to all the possible skins, and which properties are specific to a particular Skin implementation.

Right. One thing to note is that if a property is in the skin, and we document it and provide public API in our skin implementation, we are effectively "suggesting" that all skins implement that property.

> In this particular case, the size of the grid cell does not seem to belong to the control, it's clearly a property of the skin.

Perhaps, although there are many controls where sizing information is taken from the control. The most obvious example is text font and size for controls that have a label, which propagates from the control (Button, Label, ComboBox, etc) to the skin. That may or may not make a case for adding the size of the grid cell to the control.

> Then, we need to decide whether we allow extending that particular skin, and the degree in which we allow this. We may want to document the structure (hierarchy and style classes) of the skin - maybe in cssref.html, or in the skin's javadoc or similar place (Example: VFlow:78). Keep in mind that we do support both modena and caspian themes, to any changes to styles need to be reflected in both.

Yes, this is the larger issue. Whatever we do would probably be limited to those attributes that are not overly specific to one particular skin implementation.

> Or maybe even go further and design the skins explicitly to allow extension - using extendable classes and methods.

This would be a large effort, and probably not something we want to tackle.

> Then, of course, there is a question of extending behavior and that's where the discussion stalls.

Right. We are unlikely to address this any time soon.


Getting back to this specific enhancement request, we seem to have a few options, presuming we want to provide this capability without having it blocked by a much larger effort:

1. Add a private, undocumented styleable CSS property that app developers have to discover by looking at `modena.css`, reading the source code, or reading the comments in the JBS issue that implemented it. (as you can guess, I don't like this option)
2. Provide a documented styleable CSS property that would apply to the skin, but without way to set it via API on the skin
3. Provide a documented styleable CSS property in ColorPickerSkin so that there is public API as well as it being settable via CSS.
4. Add a styleable property to the ColorPicker control, which the skin would then implement.
5. Something else?

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1954#issuecomment-3482489442


More information about the openjfx-dev mailing list