Class Slider
java.lang.Object
com.github.stefvanschie.inventoryframework.pane.Pane
com.github.stefvanschie.inventoryframework.pane.component.util.VariableBar
com.github.stefvanschie.inventoryframework.pane.component.Slider
- All Implemented Interfaces:
Flippable, Orientable
A slider for a graphical interface into what amount of a whole is set.
- Since:
- 0.5.0
-
Nested Class Summary
Nested classes/interfaces inherited from class Pane
Pane.PriorityNested classes/interfaces inherited from interface Orientable
Orientable.Orientation -
Field Summary
Fields inherited from class VariableBar
backgroundPane, fillPane, flipHorizontally, flipVertically, orientation, value -
Constructor Summary
ConstructorsConstructorDescriptionSlider(int length, int height) Creates a new sliderSlider(int length, int height, @NotNull Pane.Priority priority) Creates a new sliderSlider(int length, int height, @NotNull Pane.Priority priority, @NotNull Plugin plugin) Creates a new sliderCreates a new slider -
Method Summary
Modifier and TypeMethodDescriptionbooleanclick(@NotNull Gui gui, @NotNull GuiComponent guiComponent, @NotNull InventoryClickEvent event, @NotNull Slot slot) Called whenever there is being clicked on this pane@NotNull Slidercopy()Makes a copy of this pane and returns it.floatgetValue()Gets the value as a float in between (0,1) this bar is currently set at.static @NotNull SliderLoads a percentage bar from a given elementvoidsetValue(float value) Sets the value of this bar.Methods inherited from class VariableBar
applyContents, clear, display, flipHorizontally, flipVertically, getItems, getOrientation, getPanes, isFlippedHorizontally, isFlippedVertically, setBackgroundItem, setFillItem, setHeight, setLength, setOrientationMethods inherited from class Pane
callOnClick, createBorder, findMatchingItem, getHeight, getLength, getPriority, getUUID, isVisible, load, matchesItem, setOnClick, setPriority, setVisible
-
Constructor Details
-
Slider
public Slider(int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Plugin plugin) Creates a new slider- Parameters:
length- the length of the sliderheight- the height of the sliderpriority- the priority of the sliderplugin- the plugin that will be the owner of the slider's items- Since:
- 0.12.0
-
Slider
Creates a new slider- Parameters:
length- the length of the sliderheight- the height of the sliderplugin- the plugin that will be the owner of the slider's items- Since:
- 0.12.0
-
Slider
Creates a new slider- Parameters:
length- the length of the sliderheight- the height of the sliderpriority- the priority of the slider- Since:
- 0.12.0
-
Slider
public Slider(int length, int height) Creates a new slider- Parameters:
length- the length of the sliderheight- the height of the slider- Since:
- 0.12.0
-
-
Method Details
-
click
public boolean click(@NotNull @NotNull Gui gui, @NotNull @NotNull GuiComponent guiComponent, @NotNull @NotNull InventoryClickEvent event, @NotNull @NotNull Slot slot) Description copied from class:PaneCalled whenever there is being clicked on this pane -
setValue
public void setValue(float value) Sets the value of this bar. The value has to be in (0,1). If not, this method will throw anIllegalArgumentException.- Overrides:
setValuein classVariableBar- Parameters:
value- the new value.- Throws:
IllegalArgumentException- when the value is out of range- Since:
- 0.5.0
- See Also:
-
copy
Description copied from class:PaneMakes 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. -
getValue
public float getValue()Gets the value as a float in between (0,1) this bar is currently set at.- Returns:
- the value
- Since:
- 0.5.0
-
load
@NotNull @Contract(pure=true) public static @NotNull Slider load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element, @NotNull @NotNull Plugin plugin) Loads a percentage bar from a given element- Parameters:
instance- the instance classelement- the elementplugin- the plugin that will be the owner of the udnerlying items- Returns:
- the percentage bar
- Since:
- 0.10.8
-