Package rma.swing

Class FlatPanelButton

All Implemented Interfaces:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, SwingConstants
Direct Known Subclasses:
ScriptFlatButton

public class FlatPanelButton extends JButton
See Also:
  • Constructor Details

    • FlatPanelButton

      public FlatPanelButton(String text, Icon icon)
      Creates a FlatPanelButton with initial text and an icon.
    • FlatPanelButton

      public FlatPanelButton(Action action)
      Creates a FlatPanelButton where properties are taken from the Action supplied.
    • FlatPanelButton

      public FlatPanelButton()
      Creates a FlatPanelButton with no set text or icon.
    • FlatPanelButton

      public FlatPanelButton(String text)
      Creates a FlatPanelButton with text.
    • FlatPanelButton

      public FlatPanelButton(Icon icon)
      Creates a button with an icon.
  • Method Details

    • init

      protected void init()
      initialize and setup the listeners for this button
    • setIcon

      public void setIcon(ImageIcon icon, int iWidth, int iHeight, int pos)
      This method allows the user to set an icon for the button, where the icon is located in a strip of equal sized icons.
      Parameters:
      icon - - the image with the strip of icons
      iWidth - - the width of the icon to load
      iHeight - - the height of the icon to load
      pos - - the position in the list. ie the icon, not pixels.
    • setIcon

      public void setIcon(ImageIcon icon, int iWidth, int iHeight, int posx, int posy)
      Sets the icon to be an image located at some (x,y) position with a given width and height that is contained within a larger image.
      Parameters:
      icon - - the image with the strip of icons
      iWidth - - the width of the icon to load, in pixels
      iHeight - - the height of the icon to load, in pixels
      posx - - the offset into the image in pixels to start the load in the x-direction
      posy - - the offset into the image in pixels to start the load in the y-direction
    • setHasPopupMenu

      public void setHasPopupMenu(boolean drawPopup)
    • hasPopupMenu

      public boolean hasPopupMenu()
    • paintComponent

      public void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • paintBorder

      public void paintBorder(Graphics g)
      This method paints a 1 pixel wide border around the button.
      Overrides:
      paintBorder in class AbstractButton
    • main

      public static void main(String[] args)
      Test main function. Brings up a sample dialog with two buttons