Package view

Class JRoundedButton

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

public class JRoundedButton extends JButton
Implementation of JRoundedButtons component.
See Also:
  • Constructor Details

    • JRoundedButton

      public JRoundedButton(String text, int width, int height)
      Constructs a new JRoundedButton instance.
      Parameters:
      text - the text of the button
      width - the width of the button
      height - the height of the button
    • JRoundedButton

      public JRoundedButton(int width, int height)
      Constructs a new JRoundedButton instance with blank text.
      Parameters:
      width - the width of the button
      height - the height of the button
    • JRoundedButton

      public JRoundedButton(String text, int width, int height, Color[] colors)
      Constructs a new JRoundedButton instance with non-default colors.
      Parameters:
      text - the text of the button
      width - the width of the button
      height - the height of the button
      colors - color array with colors to set the three color types
    • JRoundedButton

      public JRoundedButton(String text, int width, int height, Color[] colors, int arcWidth, int arcHeight)
      Constructs a new JRoundedButton instance with non-default colors and non-default rounding.
      Parameters:
      text - the text of the button
      width - the width of the button
      height - the height of the button
      colors - color array with colors to set the three color types
      arcWidth - the arc width we want
      arcHeight - the arc height we want
  • Method Details

    • setColor

      public void setColor(int idx, Color color)
      Sets the buttons color at the given type.
      Parameters:
      idx - the index of the type
      color - the color we want to set
    • setColors

      public void setColors(Color[] colors)
      Sets the buttons all color types.
      Parameters:
      colors - array of the color we want to set
    • setTransparent

      public void setTransparent()
      Sets to button to transparent.
    • getText

      public String getText()
      Returns the button's text.
      Overrides:
      getText in class AbstractButton
      Returns:
      the button's text
    • setText

      public void setText(String text)
      Sets the buttons text.
      Overrides:
      setText in class AbstractButton
      Parameters:
      text - the text we want to set
    • paintComponent

      protected void paintComponent(Graphics g)
      The paintComponent method of the class.
      Overrides:
      paintComponent in class JComponent
      Parameters:
      g - graphics we use