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
ConstructorDescriptionComboBoxWidget
(int x, int y, int width, int height) Constructs a newWidget
with the specified position and size. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new value to the ComboBox.Gets the accent color.int
Gets the border offset.int
Gets the width of the drop button.Gets the drop icon.Gets the name of the font.int
Gets the font size.Gets the icon color.Gets the name of the icon font.int
Gets the drop icon size.int
Gets the popup button height.int
Gets 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.int
Gets the value index.Gets the value list.void
onLeftMouseUp
(int x, int y) Called when the left mouse button is released over theWidget
.void
removeValue
(int index) Remove a value from a ComboBox.void
removeValue
(String value) Remove a value from a ComboBox.void
render()
Renders theWidget
void
setAccentColor
(NanoColor accentColor) Sets the accent color.void
setBorderOffset
(int borderOffset) Sets the border offset.void
setDropButtonWidth
(int dropButtonWidth) Sets the width of the drop button.void
setDropIcon
(String dropIcon) Sets the drop icon.void
setFontName
(String fontName) Sets the name of the font.void
setFontSize
(int fontSize) Sets the font size.void
setIconColor
(NanoColor iconColor) Sets the icon color.void
setIconFontName
(String iconFontName) Sets the name of the icon font.void
setIconSize
(int iconSize) Sets the drop icon size.void
setPopupButtonHeight
(int popupButtonHeight) Sets the popup button height.void
setPopupHeight
(int popupHeight) Sets the popup height.void
setTextColor
(NanoColor textColor) Sets the text color.void
setValueIndex
(int valueIndex) Sets the value index.void
setValueList
(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, update
Methods 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 newWidget
with 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:
onLeftMouseUp
in 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:
render
in classPanelWidget
-