Class Label
java.lang.Object
com.github.stefvanschie.inventoryframework.pane.Pane
com.github.stefvanschie.inventoryframework.pane.OutlinePane
com.github.stefvanschie.inventoryframework.pane.component.Label
- All Implemented Interfaces:
Flippable
,Orientable
,Rotatable
A label for displaying text.
- Since:
- 0.5.0
-
Nested Class Summary
Nested classes/interfaces inherited from class com.github.stefvanschie.inventoryframework.pane.OutlinePane
OutlinePane.Alignment
Nested classes/interfaces inherited from class com.github.stefvanschie.inventoryframework.pane.Pane
Pane.Priority
Nested classes/interfaces inherited from interface com.github.stefvanschie.inventoryframework.pane.Orientable
Orientable.Orientation
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
click
(@NotNull Gui gui, @NotNull InventoryComponent inventoryComponent, @NotNull InventoryClickEvent event, int slot, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Called whenever there is being clicked on this pane@NotNull Label
copy()
Makes a copy of this pane and returns it.@NotNull Font
getFont()
Gets the character set currently used for the text in this label@NotNull String
getText()
Gets the text currently displayed in this labelstatic @NotNull Label
Loads a label from a given elementvoid
Sets the text to be displayed in this labelMethods inherited from class com.github.stefvanschie.inventoryframework.pane.OutlinePane
addItem, align, applyMask, clear, display, doesRepeat, flipHorizontally, flipVertically, getAlignment, getGap, getItems, getMask, getOrientation, getPanes, getRotation, insertItem, isFlippedHorizontally, isFlippedVertically, removeItem, setGap, setHeight, setLength, setOrientation, setRepeat, setRotation
Methods inherited from class com.github.stefvanschie.inventoryframework.pane.Pane
callOnClick, findMatchingItem, getHeight, getLength, getPriority, getUUID, getX, getY, isVisible, load, loadItem, registerProperty, setOnClick, setPriority, setVisible, setX, setY
-
Constructor Details
-
Label
public Label(int x, int y, int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Font font) Creates a new label- Parameters:
x
- the x coordinatey
- the y coordinatelength
- the lengthheight
- the heightpriority
- the priorityfont
- the character set- Since:
- 0.5.0
-
Label
Creates a new label- Parameters:
x
- the x coordinatey
- the y coordinatelength
- the lengthheight
- the heightfont
- the character set- Since:
- 0.5.0
-
Label
Creates a new label- Parameters:
length
- the lengthheight
- the heightfont
- the character set- Since:
- 0.5.0
-
-
Method Details
-
setText
Sets the text to be displayed in this label- Parameters:
text
- the new text- Since:
- 0.5.0
-
copy
Description copied from class:Pane
Makes a copy of this pane and returns it. This makes a deep copy of the pane. This entails that the underlying panes and/or items will be copied as well. The returned pane will never be reference equal to the current pane.- Overrides:
copy
in classOutlinePane
- Returns:
- a copy of this pane
-
click
public boolean click(@NotNull @NotNull Gui gui, @NotNull @NotNull InventoryComponent inventoryComponent, @NotNull @NotNull InventoryClickEvent event, int slot, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Description copied from class:Pane
Called whenever there is being clicked on this pane- Overrides:
click
in classOutlinePane
- Parameters:
gui
- the gui in which was clickedinventoryComponent
- the inventory component in which this pane residesevent
- the event that occurred while clicking on this itemslot
- the slot that was clicked inpaneOffsetX
- the pane's offset on the x axispaneOffsetY
- the pane's offset on the y axismaxLength
- the maximum length of the panemaxHeight
- the maximum height of the pane- Returns:
- whether the item was found or not
-
getText
Gets the text currently displayed in this label- Returns:
- the text in this label
- Since:
- 0.5.0
-
getFont
Gets the character set currently used for the text in this label- Returns:
- the character set
- Since:
- 0.5.0
-
load
@NotNull @Contract(pure=true) public static @NotNull Label load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element) Loads a label from a given element- Parameters:
instance
- the instance classelement
- the element- Returns:
- the percentage bar
-