JDK-8161449 : Enhance CustomColorDialog to have flexibility to hide 'Opacity', 'Use' and 'Save' Button
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2016-07-15
  • Updated: 2020-01-31
  • Resolved: 2016-07-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
8u112Fixed 9Fixed
Related Reports
Blocks :  
Relates :  
To support JDK-8160837 : WebEngine doesn't handle html5 color picker. WebView requires a Custom Color picker dialog with Two Buttons (Ok and Cancel) and Color picker widget. 
CustomColorDialog would be best option to re-use in WebView With below modification. 
1. Hide Opacity Button and its slider 
2. Hide Use Button 
3. Save button text to be as OK ('Save' --> 'Ok') 

The above there modification will make the Common UX behavior observed in Windows (Firefox and chrome), Ubuntu (Firefox and chrome).
+1 Approved to backport to 8u-dev for 8u112.

Backport webrev: http://cr.openjdk.java.net/~jgiles/8161449/

JDK-8160837 depends on this. So either this enhancement needs to be backported to 8u-dev, or the 8u backport for JDK-8160837 will have to be adjusted such that it doesn't call the new methods, and as such will work differently on JDK 8. The backport for this will need to go through the 8u backport approval process, but that seems the better approach as long as the backport is straight-forward.

Changeset: http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/aa2d4b40cfe6 I created a test app that shows a CustomColorDialog as follows, and which meets your requirements: Button btn = new Button("show custom"); btn.setOnAction(e -> { CustomColorDialog dialog = new CustomColorDialog(stage); dialog.setSaveBtnText("OK"); dialog.setShowUseBtn(false); dialog.setShowOpacitySlider(false); dialog.show(); });