public class DropDown<T>
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
static int | 
OPTION_HEIGHT
The height of one option in the menu. 
 | 
| Constructor and Description | 
|---|
DropDown(java.util.List<T> options,
        int selected,
        int left,
        int top,
        int width,
        int height)
Initializes the menu. 
 | 
DropDown(java.util.List<T> options,
        int selected,
        int left,
        int top,
        int width,
        int height,
        int dropDownWidth)
Initializes the menu. 
 | 
DropDown(java.util.List<T> options,
        T selected,
        int left,
        int top,
        int width,
        int height)
Initializes the menu. 
 | 
DropDown(java.util.List<T> options,
        T selected,
        int left,
        int top,
        int width,
        int height,
        int dropDownWidth)
Initializes the menu with extended dropdown width 
 | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
getLastSelected()
Checks if an option was selected in the current mouse press. 
 | 
T | 
getSelected()
Gets the currently selected option. 
 | 
int | 
getSelectedIndex()
Gets the index of the currently selected option. 
 | 
int | 
getTop()
Gets the y coordinate of the top of the menu when inactive. 
 | 
boolean | 
getVisible()
returns true if this textbox is visible 
 | 
boolean | 
isMouseOver(int mouseX,
           int mouseY)
Gets the index of the element that the cursor is currently over. 
 | 
void | 
render(com.mojang.blaze3d.matrix.MatrixStack matrix,
      int mouseX,
      int mouseY,
      float partialTicks,
      DropDown active)
Draws the list to the screen. 
 | 
DropDown<T> | 
setGetOptionString(java.util.function.Function<T,java.lang.String> getOptionString)
Sets the function used to convert an option to a string. 
 | 
DropDown<T> | 
setInactiveHeight(int height)
Sets the height of the menu when inactive. 
 | 
DropDown<T> | 
setInactiveTop(int top)
Sets the top of the menu when inactive. 
 | 
DropDown<T> | 
setOnSelected(java.util.function.Consumer<T> onSelected)
Sets a method to call when an option is selected. 
 | 
DropDown<T> | 
setOnSelectedIndex(java.util.function.Consumer<java.lang.Integer> onSelectedIndex)
Sets a method to call when an option is selected. 
 | 
void | 
setOptions(java.util.List<T> options,
          T selected)
Sets the options in the list. 
 | 
DropDown<T> | 
setOrdered()
Sorts the options in the menu by name. 
 | 
void | 
setSelected(int selected)
Sets the currently selected option. 
 | 
void | 
setSelected(T selected)
Sets the currently selected option. 
 | 
DropDown<T> | 
setTextAlign(TextAlignment align)
Sets the alignment of text in the menu. 
 | 
void | 
setVisible(boolean isVisible)
Sets whether or not this textbox is visible 
 | 
public static final int OPTION_HEIGHT
public DropDown(java.util.List<T> options, int selected, int left, int top, int width, int height)
options - The options that can be selected in the list.selected - The index of the currently selected option.left - The x coordinate of the left side of the slot.top - The y coordinate of the top of the slot.width - The width of the slot.height - The height of the slot.public DropDown(java.util.List<T> options, int selected, int left, int top, int width, int height, int dropDownWidth)
options - The options that can be selected in the list.selected - The index of the currently selected option.left - The x coordinate of the left side of the slot.top - The y coordinate of the top of the slot.width - The width of the slot.height - The height of the slot.dropDownWidth - The width of the dropdown boxpublic DropDown(java.util.List<T> options, T selected, int left, int top, int width, int height)
options - The options that can be selected in the list.selected - The currently selected option.left - The x coordinate of the left side of the slot.top - The y coordinate of the top of the slot.width - The width of the slot.height - The height of the slot.public DropDown(java.util.List<T> options, T selected, int left, int top, int width, int height, int dropDownWidth)
options - The options that can be selected in the list.selected - The currently selected option.left - The x coordinate of the left side of the slot.top - The y coordinate of the top of the slot.width - The width of the slot.height - The height of the slot.public void setOptions(java.util.List<T> options, T selected)
options - The options that can be selected in the list.selected - The index of the currently selected option.public void setSelected(T selected)
selected - The currently selected option.public void setSelected(int selected)
selected - The index of the currently selected option.public DropDown<T> setInactiveTop(int top)
top - The y coordinate of the top of the menu when inactive.public DropDown<T> setInactiveHeight(int height)
height - The y coordinate of the top of the menu when inactive.public DropDown<T> setTextAlign(TextAlignment align)
align - The alignment of text in the menu.public DropDown<T> setGetOptionString(java.util.function.Function<T,java.lang.String> getOptionString)
getOptionString - The function used to convert an option to a string.public DropDown<T> setOnSelected(java.util.function.Consumer<T> onSelected)
onSelected - The method to call when an option is selected.public DropDown<T> setOnSelectedIndex(java.util.function.Consumer<java.lang.Integer> onSelectedIndex)
onSelectedIndex - The method to call when an option is selected.public DropDown<T> setOrdered()
public T getSelected()
public void render(com.mojang.blaze3d.matrix.MatrixStack matrix,
                   int mouseX,
                   int mouseY,
                   float partialTicks,
                   DropDown active)
mouseX - The x coordinate of the mouse.mouseY - The y coordinate of the mouse.partialTicks - The current number of partial ticks.public boolean isMouseOver(int mouseX,
                           int mouseY)
mouseX - The x coordinate of the cursor.mouseY - The y coordinate of the cursor.public boolean getLastSelected()
public int getTop()
public int getSelectedIndex()
public boolean getVisible()
public void setVisible(boolean isVisible)