Class GUIItemShortcut

All Implemented Interfaces:
GUIElement, GUIScrollable, ImageObserver, MenuContainer, Serializable

public class GUIItemShortcut extends GUIItem
Displays a shortcut command.
See Also:
  • Constructor Details

    • GUIItemShortcut

      public GUIItemShortcut(@NotNull @NotNull TooltipManager tooltipManager, @NotNull @NotNull GUIElementListener elementListener, @NotNull @NotNull String name, @Nullable @Nullable Color activateColor, @Nullable @Nullable Image activateImage, @Nullable @Nullable Color immediateColor, @Nullable @Nullable Image immediateImage, @NotNull @NotNull ShortcutSlot shortcutSlot, @NotNull @NotNull FacesManager facesManager, @NotNull @NotNull CommandExecutor commandExecutor, @NotNull @NotNull Shortcuts shortcuts, @NotNull @NotNull Font font, @NotNull @NotNull GuiFactory guiFactory)
      Creates a new instance.
      Parameters:
      tooltipManager - the tooltip manager to update
      elementListener - the element listener to notify
      name - the name of this element
      activateColor - the background color for shortcuts that activate the command
      activateImage - the overlay image for shortcuts that activate the command
      immediateColor - the background color for shortcuts that immediately execute the command
      immediateImage - the overlay image for shortcuts that immediately execute the command
      shortcutSlot - the shortcut slot
      facesManager - the faces manager instance for looking up faces
      commandExecutor - the command executor for executing commands
      shortcuts - the shortcuts instance for looking up shortcuts
      font - the font for displaying the key that activates the shortcut
      guiFactory - the global GUI factory instance
  • Method Details

    • dispose

      public void dispose()
      Description copied from interface: GUIElement
      Releases all allocated resources.
      Specified by:
      dispose in interface GUIElement
      Overrides:
      dispose in class AbstractGUIElement
    • getTooltip

      @Nullable public @Nullable TooltipText getTooltip()
      Description copied from class: AbstractGUIElement
      Returns the current tooltip text.
      Specified by:
      getTooltip in class AbstractGUIElement
      Returns:
      the tooltip text or null to not show a tooltip
    • notifyOpen

      public void notifyOpen()
      Description copied from interface: GUIElement
      Called each time the enclosing dialog is opened (or raised).
    • button1Clicked

      public void button1Clicked(int modifiers)
      Description copied from class: GUIItem
      Called when the left mouse button was pressed.
      Specified by:
      button1Clicked in class GUIItem
      Parameters:
      modifiers - the input event modifiers
    • button2Clicked

      public void button2Clicked(int modifiers)
      Description copied from class: GUIItem
      Called when the middle mouse button was pressed.
      Specified by:
      button2Clicked in class GUIItem
      Parameters:
      modifiers - the input event modifiers
    • button3Clicked

      public void button3Clicked(int modifiers)
      Description copied from class: GUIItem
      Called when the right mouse button was pressed.
      Specified by:
      button3Clicked in class GUIItem
      Parameters:
      modifiers - the input event modifiers
    • paintComponent

      public void paintComponent(@NotNull @NotNull Graphics g)
      Overrides:
      paintComponent in class JComponent
    • getPreferredSize

      @NotNull public @NotNull Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • getMinimumSize

      @NotNull public @NotNull Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent
    • canScroll

      public boolean canScroll(int distance)
      Description copied from interface: GUIScrollable
      Returns whether scrolling is possible.
      Parameters:
      distance - the distance to scroll
      Returns:
      whether scrolling is possible
    • scroll

      public void scroll(int distance)
      Description copied from interface: GUIScrollable
      Scrolls the element.
      Parameters:
      distance - the distance to scroll
    • resetScroll

      public void resetScroll()
      Description copied from interface: GUIScrollable
      Resets the scroll index to the default value.