Class FreeColActionUI

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.util.EventListener, OptionUpdater

    public final class FreeColActionUI
    extends OptionUI<FreeColAction>
    implements java.awt.event.ActionListener
    User interface for displaying/changing a keyboard accelerator for a FreeColAction.
    • Field Detail

      • keyStroke

        private javax.swing.KeyStroke keyStroke
      • recordButton

        private final javax.swing.JButton recordButton
      • removeButton

        private final javax.swing.JButton removeButton
      • panel

        private final javax.swing.JPanel panel
    • Constructor Detail

      • FreeColActionUI

        public FreeColActionUI​(FreeColAction option,
                               boolean editable)
        Creates a new FreeColActionUI for the given FreeColAction.
        Parameters:
        option - The FreeColAction to make a user interface for.
        editable - boolean whether user can modify the setting
    • Method Detail

      • getRecordImage

        public static javax.swing.ImageIcon getRecordImage()
        Creates an icon for symbolizing the recording of a KeyStroke.
        Returns:
        The ImageIcon.
      • getRemoveImage

        public static javax.swing.ImageIcon getRemoveImage()
        Creates an icon to be used on the button that removes a keyboard accelerator.
        Returns:
        The ImageIcon.
      • getHumanKeyStrokeText

        public static java.lang.String getHumanKeyStrokeText​(javax.swing.KeyStroke keyStroke)
        Gets a string to represent the given KeyStroke to the user.
        Parameters:
        keyStroke - java.awt.event.KeyStroke
        Returns:
        String
      • removeKeyStroke

        public void removeKeyStroke​(javax.swing.KeyStroke k)
        Removes the given KeyStroke. That is: This action's KeyStroke is set to null if it is the same as the given KeyStroke.
        Parameters:
        k - The KeyStroke to be removed.
      • setOptionGroupUI

        public void setOptionGroupUI​(OptionGroupUI ui)
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent ae)
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
      • getComponent

        public javax.swing.JPanel getComponent()
        Get the Component used to set the value of the Option.
        Specified by:
        getComponent in class OptionUI<FreeColAction>
        Returns:
        a JComponent value