Class JButton

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

public class JButton extends JButton
According to the gvSIG's GUI style sheet all the buttons in the application will have a normative size. No smaller than a concrete size, and big enough to contain the text and avoiding the "..." characters. The button will grow up in width by a set of widths defined in this style sheet, always choosing the smallest width that can contain the text. If the biggest width is not enought for this purpose then the button will automatically grow up to the smallest necessary width to fit the text.

The button resizing is based on the setText(String txt) method. However, it is possible to use a custom size if you invoke one of setSize(..), setBorders(...) or setPreferredSize(...) after invoking the setText(...) method.

This class is just a standard javax.swing.JButton that handles this issue.

Author:
jaume dominguez faus - jaume.dominguez@iver.es
See Also:
  • Constructor Details

    • JButton

      public JButton()
      Creates a new empty instance of org.gvsig.gui.beans.swing.JButton.
    • JButton

      public JButton(String text)
      Creates a new instance of org.gvsig.gui.beans.swing.JButton containing a text.
      Parameters:
      text -
    • JButton

      public JButton(String text, Icon icon)
      Creates a new instance of org.gvsig.gui.beans.swing.JButton containing an image and a text.
      Parameters:
      text -
      icon -
    • JButton

      public JButton(Icon icon)
      Creates a new instance of org.gvsig.gui.beans.swing.JButton containing an image.
  • Method Details

    • getEnableText

      public String getEnableText()
      Gets the text that appears in the tooltip when the button is disabled.
      Returns:
      String
    • setEnableText

      public void setEnableText(String enableText)
      Sets the text that appears in the tooltip when the button is disabled.
      Parameters:
      enableText - The enableText to set.
    • setEnabled

      public void setEnabled(boolean aFlag)
      Overrides:
      setEnabled in class AbstractButton
    • setToolTip

      public void setToolTip(String text)
      Sets the text that appears in the tooltip when the button is enabled.
    • setText

      public void setText(String text)
      Overrides:
      setText in class AbstractButton