ColorButton Class

This is a class that extends JButton class. The ColorButton object can be added to a JFrame. Create ColorButton class with the following properties:

  1. Instance variables: Declare three instance variables:
    • A String object for the button label
    • A Color object for the pen color
    • A Dimension object for the size of the button
  2. Constructor: Take in four arguments:
    • The String label that will go on this button
    • The Color this button will change the pen's "ink" color to.
    • An int for the width of the button
    • An int for the height of the button
    First you must call the super constructor for JButton. This constructor takes the label String that will be displayed on the button. After calling the super constructor, assign the instance variables. The Dimension size can be created from the int for width and the int for height that were passed in.
  3. Accessor method: return the label of the button.
  4. Accessor method: return the color of "ink" that this button has.
  5. Accessor method: return the size of this button.