Class GUIItemItem

All Implemented Interfaces:
GUIElement, GUIScrollable, ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
GUIItemFloor, GUIItemInventory, GUIItemKnowledge, GUIItemKnowledgeType, GUIItemQuest, GUIItemSpell, GUIItemSpellSkill

public abstract class GUIItemItem extends GUIItem
A GUIElement instance representing an in-game item.
See Also:
  • Constructor Details

    • GUIItemItem

      protected GUIItemItem(@NotNull @NotNull TooltipManager tooltipManager, @NotNull @NotNull GUIElementListener elementListener, @NotNull @NotNull String name, @NotNull @NotNull ItemPainter itemPainter, @NotNull @NotNull FacesManager facesManager, @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
      itemPainter - the item painter for painting the icon
      facesManager - the faces manager instance to use
      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
    • paintComponent

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

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

      @Nullable public @Nullable Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent
    • getFace

      @NotNull protected abstract @NotNull Image getFace(@NotNull @NotNull CfItem item)
      Returns the face for a CfItem instance.
      Parameters:
      item - the item instance
      Returns:
      the face
    • getItem

      @Nullable public @Nullable CfItem getItem()
      Returns the current item instance.
      Returns:
      the current item instance
    • setItem

      protected void setItem(@Nullable @Nullable CfItem item)
      Sets the current item instance.
      Parameters:
      item - the new current item instance
    • setItemNoListeners

      protected void setItemNoListeners(@Nullable @Nullable CfItem item)
      Sets the current item instance without registering listeners for updates.
      Parameters:
      item - the new current item instance
    • setSelected

      public abstract void setSelected(boolean selected)
      Sets the selected state.
      Parameters:
      selected - whether this element should be drawn as "selected"
    • isSelected

      protected abstract boolean isSelected()
      Returns whether this element should be drawn as "selected".
      Returns:
      whether this element is selected
    • getIndex

      public abstract int getIndex()
      Returns the slot index.
      Returns:
      the slot index
    • setIndexNoListeners

      public abstract void setIndexNoListeners(int index)
      Sets the slot index to display without registering listeners for updates.
      Parameters:
      index - the slot index
    • 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