Class JMenuItemHpr

java.lang.Object
com.ribs.RJHelper
com.ribs.helpers.JMenuItemHpr

public class JMenuItemHpr extends RJHelper
A RJHelper implementation for JMenuItem (with specific support for subclasses: JMenu, JCheckBoxMenuItem).
  • Constructor Details

    • JMenuItemHpr

      public JMenuItemHpr()
  • Method Details

    • newInstance

      public Object newInstance(RXElement anElement)
      Creates a new instance of class for given element.
      Overrides:
      newInstance in class RJHelper
    • initInstance

      public void initInstance(JComponent aComponent)
      Initializes the given instance (actually called the first time an owner is set).
      Overrides:
      initInstance in class RJHelper
    • getComponentCount

      public int getComponentCount(JComponent aComponent)
      Returns the Ribs-relevant child component count.
      Overrides:
      getComponentCount in class RJHelper
    • getComponent

      public JComponent getComponent(JComponent aComponent, int anIndex)
      Returns the Ribs-relevant child component at the given index.
      Overrides:
      getComponent in class RJHelper
    • getImageName

      public String getImageName(JComponent aComponent)
      Returns the image name for this button's icon.
    • setImageName

      public void setImageName(JComponent aComponent, String aName)
      Sets the image name for this button's icon and tries to set the icon by asking Ribs for the named icon.
    • getStringValue

      public String getStringValue(JComponent aComponent)
      Returns the menu item's text.
      Overrides:
      getStringValue in class RJHelper
    • setValue

      public void setValue(JComponent aComponent, String aValue)
      Sets the menu item's text.
      Overrides:
      setValue in class RJHelper
    • getBoolValue

      public boolean getBoolValue(JComponent aComponent)
      Returns whether menu item is selected (or state if check box menu item).
      Overrides:
      getBoolValue in class RJHelper
    • setValue

      public void setValue(JComponent aComponent, boolean aValue)
      Sets whether the menu item is selected (or state if check box menu item).
      Overrides:
      setValue in class RJHelper
    • getIntValue

      public int getIntValue(JComponent aComponent)
      Returns the menu item's text as an int.
      Overrides:
      getIntValue in class RJHelper
    • getFloatValue

      public float getFloatValue(JComponent aComponent)
      Returns the menu item's text as an int.
      Overrides:
      getFloatValue in class RJHelper
    • toXML

      public RXElement toXML(JComponent aComponent, RXArchiver anArchiver)
      XML archival.
      Overrides:
      toXML in class RJHelper
    • fromXML

      public void fromXML(JComponent aComponent, RXArchiver anArchiver, RXElement anElement)
      XML unarchival.
      Overrides:
      fromXML in class RJHelper
    • getKeyText

      public static String getKeyText(KeyStroke aKeyStroke)
      This utility method returns key text for a key stroke and tries to make it more conforming.
    • getKeyStroke

      public static KeyStroke getKeyStroke(String aString)
      This utility method tries to get a keystroke from a string and tries to be more forgiving than KeyStroke.getKeyStroke().