Class ColorButton

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

    public final class ColorButton
    extends JButton
    JButton that opens a Color Chooser when clicked and shows the previously set color as an icon. You can use the addPropertyChangeListener method to listen for a PropertyChangeEvent (for the property "color") whenever a new color is selected by the user.
    See Also:
    Serialized Form

    Module: swing-util-api

    To use this in your app, include the following dependency in your POM:

    <dependency>
        <groupId>org.cytoscape</groupId>
        <artifactId>swing-util-api</artifactId>
    </dependency>

    Cytoscape Backwards Compatibility (Final Class): This class is final and therefore can't be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.
    • Constructor Detail

      • ColorButton

        public ColorButton​(Color color)
    • Method Detail

      • setColor

        public void setColor​(Color color)
        Sets a new color and fires a PropertyChangeEvent for the property "color".
        Parameters:
        color -
      • getColor

        public Color getColor()
        Returns:
        The currently selected color.