Class RgbColorChooser


  • public class RgbColorChooser
    extends Object
    RgbColorChooser is a custom color chooser that only allows users to select colors in the RGB color space.
    Since:
    6.3
    • Constructor Detail

      • RgbColorChooser

        public RgbColorChooser()
    • Method Detail

      • showDialog

        public static Color showDialog​(Component component,
                                       String title,
                                       Color initialColor)
                                throws HeadlessException
        Shows a modal color-chooser dialog and blocks until the dialog is hidden. If the user presses the "OK" button, then this method hides/disposes the dialog and returns the selected color. If the user presses the "Cancel" button or closes the dialog without pressing "OK", then this method hides/disposes the dialog and returns null.
        Parameters:
        component - the parent Component for the dialog
        title - the String containing the dialog's title
        initialColor - the initial Color set when the color-chooser is shown
        Returns:
        the selected color or null if the user opted out
        Throws:
        HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
        See Also:
        GraphicsEnvironment.isHeadless()