Class JXColorSelectionButton

  • All Implemented Interfaces:
    ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, SwingConstants

    public class JXColorSelectionButton
    extends JButton
    A button which allows the user to select a single color. The button has a platform specific look. Ex: on Mac OS X it will mimic an NSColorWell. When the user clicks the button it will open a color chooser set to the current background color of the button. The new selected color will be stored in the background property and can be retrieved using the getBackground() method. As the user is choosing colors within the color chooser the background property will be updated. By listening to this property developers can make other parts of their programs update.
    Author:
    joshua@marinacci.org
    See Also:
    Serialized Form
    • Constructor Detail

      • JXColorSelectionButton

        public JXColorSelectionButton()
        Creates a new instance of JXColorSelectionButton
      • JXColorSelectionButton

        public JXColorSelectionButton​(Color col)
        Creates a new instance of JXColorSelectionButton set to the specified color.
        Parameters:
        col - The default color
    • Method Detail

      • getChooser

        public JColorChooser getChooser()
        Get the JColorChooser that is used by this JXColorSelectionButton. This chooser instance is shared between all invocations of the chooser, but is unique to this instance of JXColorSelectionButton.
        Returns:
        the JColorChooser used by this JXColorSelectionButton
      • setChooser

        public void setChooser​(JColorChooser chooser)
        Set the JColorChooser that is used by this JXColorSelectionButton. chooser instance is shared between all invocations of the chooser, but is unique to this instance of JXColorSelectionButton.
        Parameters:
        chooser - The new JColorChooser to use.