Package com.avrix.ui.widgets
Class ComboBoxWidget
java.lang.Object
com.avrix.ui.widgets.Widget
com.avrix.ui.widgets.PanelWidget
com.avrix.ui.widgets.ComboBoxWidget
A customizable
ComboBoxWidget.
This widget allows users to select a value from a dropdown list.-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionComboBoxWidget(int x, int y, int width, int height) Constructs a newWidgetwith the specified position and size. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new value to the ComboBox.Gets the accent color.intGets the border offset.intGets the width of the drop button.Gets the drop icon.Gets the name of the font.intGets the font size.Gets the icon color.Gets the name of the icon font.intGets the drop icon size.intGets the popup button height.intGets the popup height.Gets the text color.getValue()Returns the current value of the ComboBox.getValue(int index) Returns the value at the specified index.intGets the value index.Gets the value list.voidonLeftMouseUp(int x, int y) Called when the left mouse button is released over theWidget.voidremoveValue(int index) Remove a value from a ComboBox.voidremoveValue(String value) Remove a value from a ComboBox.voidrender()Renders theWidgetvoidsetAccentColor(NanoColor accentColor) Sets the accent color.voidsetBorderOffset(int borderOffset) Sets the border offset.voidsetDropButtonWidth(int dropButtonWidth) Sets the width of the drop button.voidsetDropIcon(String dropIcon) Sets the drop icon.voidsetFontName(String fontName) Sets the name of the font.voidsetFontSize(int fontSize) Sets the font size.voidsetIconColor(NanoColor iconColor) Sets the icon color.voidsetIconFontName(String iconFontName) Sets the name of the icon font.voidsetIconSize(int iconSize) Sets the drop icon size.voidsetPopupButtonHeight(int popupButtonHeight) Sets the popup button height.voidsetPopupHeight(int popupHeight) Sets the popup height.voidsetTextColor(NanoColor textColor) Sets the text color.voidsetValueIndex(int valueIndex) Sets the value index.voidsetValueList(List<String> valueList) Sets the value list.Methods inherited from class com.avrix.ui.widgets.PanelWidget
isDraggable, onLeftMouseDown, onLeftMouseUpOutside, postRender, setBackgroundColor, setBorderColor, setBorderRadius, setBorderWidth, setDraggable, setDrawBorder, updateMethods inherited from class com.avrix.ui.widgets.Widget
addChild, addToScreen, bringToTop, drawArc, drawArc, drawCircle, drawEllipse, drawImage, drawLine, drawRect, drawRectOutline, drawRoundedRect, drawRoundedRectOutline, drawText, getAbsoluteParent, getChildren, getHeight, getMaxScrollX, getMaxScrollY, getParent, getScrollSpeed, getScrollX, getScrollY, getWidth, getX, getXA, getY, getYA, intersectScissor, isAlwaysOnTop, isHovered, isPointOver, isScrollable, isScrollLock, isVisible, isVisibleWithinParent, isVisibleWithinWindow, onInitialize, onKeyPress, onKeyRelease, onKeyRepeat, onLeftMouseDownOutside, onMouseEnter, onMouseExit, onMouseMove, onMouseMoveOutside, onMouseWheel, onRightMouseDown, onRightMouseDownOutside, onRightMouseUp, onRightMouseUpOutside, preRender, removeChild, removeFromScreen, renderChildren, setAlwaysOnTop, setHeight, setMaxScrollX, setMaxScrollY, setScrollable, setScrollLock, setScrollSpeed, setScrollX, setScrollY, setVisible, setWidth, setX, setXA, setY, setYA
-
Constructor Details
-
ComboBoxWidget
public ComboBoxWidget(int x, int y, int width, int height) Constructs a newWidgetwith the specified position and size.
-
-
Method Details
-
onLeftMouseUp
public void onLeftMouseUp(int x, int y) Called when the left mouse button is released over theWidget.- Overrides:
onLeftMouseUpin classPanelWidget- Parameters:
x- relative x-coordinate of the mouse positiony- relative y-coordinate of the mouse position
-
getValue
Returns the current value of the ComboBox.- Returns:
- the currently selected value
-
getValue
Returns the value at the specified index.- Parameters:
index- the index of the value to return- Returns:
- the value at the specified index
-
addValue
Adds a new value to the ComboBox.- Parameters:
value- the value to add
-
removeValue
Remove a value from a ComboBox.- Parameters:
value- the value to remove
-
removeValue
public void removeValue(int index) Remove a value from a ComboBox.- Parameters:
index- index of the value to be deleted
-
getIconFontName
Gets the name of the icon font.- Returns:
- the name of the icon font
-
setIconFontName
Sets the name of the icon font.- Parameters:
iconFontName- the new name of the icon font
-
getFontName
Gets the name of the font.- Returns:
- the name of the font
-
setFontName
Sets the name of the font.- Parameters:
fontName- the new name of the font
-
getDropIcon
Gets the drop icon.- Returns:
- the drop icon
-
setDropIcon
Sets the drop icon.- Parameters:
dropIcon- the new drop icon
-
getDropButtonWidth
public int getDropButtonWidth()Gets the width of the drop button.- Returns:
- the width of the drop button
-
setDropButtonWidth
public void setDropButtonWidth(int dropButtonWidth) Sets the width of the drop button.- Parameters:
dropButtonWidth- the new width of the drop button
-
getValueIndex
public int getValueIndex()Gets the value index.- Returns:
- the value index
-
setValueIndex
public void setValueIndex(int valueIndex) Sets the value index.- Parameters:
valueIndex- the new value index
-
getPopupHeight
public int getPopupHeight()Gets the popup height.- Returns:
- the popup height
-
setPopupHeight
public void setPopupHeight(int popupHeight) Sets the popup height.- Parameters:
popupHeight- the new popup height
-
getPopupButtonHeight
public int getPopupButtonHeight()Gets the popup button height.- Returns:
- the popup button height
-
setPopupButtonHeight
public void setPopupButtonHeight(int popupButtonHeight) Sets the popup button height.- Parameters:
popupButtonHeight- the new popup button height
-
getFontSize
public int getFontSize()Gets the font size.- Returns:
- the font size
-
setFontSize
public void setFontSize(int fontSize) Sets the font size.- Parameters:
fontSize- the new font size
-
getValueList
Gets the value list.- Returns:
- the value list
-
setValueList
Sets the value list.- Parameters:
valueList- the new value list
-
getIconColor
Gets the icon color.- Returns:
- the icon color
-
setIconColor
Sets the icon color.- Parameters:
iconColor- the new icon color
-
getTextColor
Gets the text color.- Returns:
- the text color
-
setTextColor
Sets the text color.- Parameters:
textColor- the new text color
-
getAccentColor
Gets the accent color.- Returns:
- the accent color
-
setAccentColor
Sets the accent color.- Parameters:
accentColor- the new accent color
-
getIconSize
public int getIconSize()Gets the drop icon size.- Returns:
- the icon size
-
setIconSize
public void setIconSize(int iconSize) Sets the drop icon size.- Parameters:
iconSize- the new icon size
-
getBorderOffset
public int getBorderOffset()Gets the border offset.- Returns:
- the border offset
-
setBorderOffset
public void setBorderOffset(int borderOffset) Sets the border offset.- Parameters:
borderOffset- the new border offset
-
render
public void render()Renders theWidget- Overrides:
renderin classPanelWidget
-