Package rma.swing

Class FlatPanelToggleButton

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

public class FlatPanelToggleButton extends JToggleButton
See Also:
  • Constructor Details

    • FlatPanelToggleButton

      public FlatPanelToggleButton(String text, Icon icon)
      Creates a FlatPanelButton with initial text and an icon.
      Parameters:
      text - Description
      icon - Description
    • FlatPanelToggleButton

      public FlatPanelToggleButton(Icon icon, boolean selected)
    • FlatPanelToggleButton

      public FlatPanelToggleButton(Action action)
      Creates a FlatPanelButton where properties are taken from the Action supplied.
      Parameters:
      action - Description
    • FlatPanelToggleButton

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

      public FlatPanelToggleButton(String text)
      Creates a FlatPanelButton with text.
      Parameters:
      text - Description
    • FlatPanelToggleButton

      public FlatPanelToggleButton(Icon icon)
      Creates a button with an icon.
      Parameters:
      icon - Description
  • 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)
      Sets the HasPopupMenu attribute of the FlatPanelToggleButton object
      Parameters:
      drawPopup - The new HasPopupMenu value
    • hasPopupMenu

      public boolean hasPopupMenu()
      Method Description
      Returns:
      Description
    • paintComponent

      public void paintComponent(Graphics g)
      Method Description
      Overrides:
      paintComponent in class JComponent
      Parameters:
      g - Description
    • paintBorder

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

      public static void main(String[] args)
      Test main function. Brings up a sample dialog with two buttons
      Parameters:
      args - The command line arguments