Package com.spinyowl.legui.component
Class Widget
java.lang.Object
com.spinyowl.legui.component.Component
com.spinyowl.legui.component.Widget
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Dialog
Widget component is container which have predefined components such as container, title label,
close and minimize buttons and predefined event listeners. This component can be moved, minimized
and restored, closed. Also you can enable or disable title and make widget non-ascendible using
setAscendible(boolean).- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWidget()Creates a widget with default title text.Widget(boolean ascendible) Creates a widget with default title text.Widget(float x, float y, float width, float height) Creates a widget with default title text and specified position and size.Widget(float x, float y, float width, float height, boolean ascendible) Creates a widget with default title text and specified position and size.Creates a widget with specified title text.Creates a widget with specified title text.Creates a widget with specified title text and specified position and size.Creates a widget with specified title text and specified position and size.Creates a widget with specified title text and specified position and size.Creates a widget with specified title text and specified position and size.Widget(org.joml.Vector2f position, org.joml.Vector2f size) Creates a widget with default title text and specified position and size.Widget(org.joml.Vector2f position, org.joml.Vector2f size, boolean ascendible) Creates a widget with default title text and specified position and size. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddWidgetCloseEventListener(EventListener<WidgetCloseEvent> eventListener) Used to add event listener for widget close event.voidapplyStylesToContainer(Component container) booleanReturns close button of widget.org.joml.Vector4fReturns close button text color.Returns close icon that used by close button.Returns widget container that hold all other elements.Returns maximize icon that used by minimize button.Returns minimize button of widget.Returns minimize icon that used by minimize button.getTitle()Returns title container.floatReturns height of title.Returns title text state.Returns all event listeners for widget close event.inthashCode()voidhide()voidinitialize(String title) This method used to initialize widget.booleanReturns true if widget could ascend to the top in parent container.booleanReturns true if widget should be closeable.booleanReturns true if widget could be dragged.booleanReturns true if widget could be minimized (minimize button is visible).booleanReturns true if widget minimized.booleanbooleanReturns true if title enabled.voidremoveWidgetCloseEventListener(EventListener<WidgetCloseEvent> eventListener) Used to remove event listener for widget close event.voidsetAscendible(boolean ascendible) Set true to make widget ascend to the top in parent container on click event on widget or any component inside.voidsetCloseable(boolean closeable) Used to set would widget closeable or not.voidsetCloseButtonColor(org.joml.Vector4f closeButtonColor) Used to set close button text color.voidsetCloseIcon(Icon closeIcon) Used to set close icon to close button.voidsetContainer(Component container) Used to set widget container.voidsetDraggable(boolean draggable) Used to set widget draggable or not.voidsetMaximizeIcon(Icon maximizeIcon) Used to set maximize icon to minimize button.voidsetMinimizable(boolean minimizable) Used to make minimize button visible or not.voidsetMinimized(boolean minimized) Used to minimize/maximize widget.voidsetMinimizeIcon(Icon minimizeIcon) Used to set minimize icon to minimize button.voidsetResizable(boolean resizable) voidsetTitleEnabled(boolean titleEnabled) Used to set title enabled or not.voidsetTitleHeight(float titleHeight) Used to set title height.voidshow()toString()Methods inherited from class com.spinyowl.legui.component.Component
add, add, addAll, clearChildComponents, containerIterator, contains, containsAll, count, forEach, getAbsolutePosition, getChildComponents, getFocusedStyle, getFrame, getHoveredStyle, getIntersector, getLayer, getListenerMap, getMetadata, getParent, getPosition, getPressedStyle, getSize, getStyle, getTabIndex, getTooltip, indexOfChild, intersects, isEmpty, isEnabled, isFocusable, isFocused, isHovered, isPressed, isTabFocusable, isVisible, keepRendering, keepRendering, parallelStream, remove, remove, removeAll, removeIf, setEnabled, setFocusable, setFocused, setHovered, setIntersector, setListenerMap, setParent, setPosition, setPosition, setPressed, setSize, setSize, setStyle, setTabFocusable, setTabIndex, setTooltip, stream
-
Field Details
-
DEFAULT_WIDGET_TITLE
Default widget title.- See Also:
-
-
Constructor Details
-
Widget
public Widget()Creates a widget with default title text. Ascendible by default (SeeisAscendible()). -
Widget
public Widget(boolean ascendible) Creates a widget with default title text. Ascendible by default (SeeisAscendible()).- Parameters:
ascendible- used to make it ascendible or not.
-
Widget
public Widget(float x, float y, float width, float height) Creates a widget with default title text and specified position and size. Ascendible by default (SeeisAscendible()).- Parameters:
x- x position in parent.y- y position in parent.width- width of component.height- height of component.
-
Widget
public Widget(float x, float y, float width, float height, boolean ascendible) Creates a widget with default title text and specified position and size. Ascendible by default (SeeisAscendible()).- Parameters:
x- x position in parent.y- y position in parent.width- width of component.height- height of component.ascendible- used to make it ascendible or not.
-
Widget
public Widget(org.joml.Vector2f position, org.joml.Vector2f size) Creates a widget with default title text and specified position and size. Ascendible by default (SeeisAscendible()).- Parameters:
position- position in parent.size- size of component.
-
Widget
public Widget(org.joml.Vector2f position, org.joml.Vector2f size, boolean ascendible) Creates a widget with default title text and specified position and size. Ascendible by default (SeeisAscendible()).- Parameters:
position- position in parent.size- size of component.ascendible- used to make it ascendible or not.
-
Widget
Creates a widget with specified title text. Ascendible by default (SeeisAscendible()).- Parameters:
title- widget text.
-
Widget
Creates a widget with specified title text. Ascendible by default (SeeisAscendible()).- Parameters:
title- widget text.ascendible- used to make it ascendible or not.
-
Widget
Creates a widget with specified title text and specified position and size. Ascendible by default (SeeisAscendible()).- Parameters:
title- widget text.x- x position in parent.y- y position in parent.width- width of component.height- height of component.
-
Widget
Creates a widget with specified title text and specified position and size. Ascendible by default (SeeisAscendible()).- Parameters:
title- widget text.x- x position in parent.y- y position in parent.width- width of component.height- height of component.ascendible- used to make it ascendible or not.
-
Widget
Creates a widget with specified title text and specified position and size. Ascendible by default (SeeisAscendible()).- Parameters:
title- widget text.position- position in parent.size- size of component.
-
Widget
Creates a widget with specified title text and specified position and size. Ascendible by default (SeeisAscendible()).- Parameters:
title- widget text.position- position in parent.size- size of component.ascendible- used to make it ascendible or not.
-
-
Method Details
-
initialize
This method used to initialize widget.- Parameters:
title- title to set.
-
applyStylesToContainer
-
getTitleHeight
public float getTitleHeight()Returns height of title.- Returns:
- height of title.
-
setTitleHeight
public void setTitleHeight(float titleHeight) Used to set title height.- Parameters:
titleHeight- title height to set.
-
isTitleEnabled
public boolean isTitleEnabled()Returns true if title enabled.- Returns:
- true if title enabled.
-
setTitleEnabled
public void setTitleEnabled(boolean titleEnabled) Used to set title enabled or not.- Parameters:
titleEnabled- title state (enable or not) to set.
-
isCloseable
public boolean isCloseable()Returns true if widget should be closeable.- Returns:
- true if widget should be closeable.
-
setCloseable
public void setCloseable(boolean closeable) Used to set would widget closeable or not.- Parameters:
closeable- widget state (closeable or not) to set.
-
getCloseButton
Returns close button of widget.- Returns:
- close button of widget.
-
getMinimizeButton
Returns minimize button of widget.- Returns:
- minimize button of widget.
-
getTitleContainer
Returns title container. Can be used to customize widget.- Returns:
- title container.
-
getTitleTextState
Returns title text state.- Returns:
- title text state.
-
getTitle
-
getCloseButtonColor
public org.joml.Vector4f getCloseButtonColor()Returns close button text color.- Returns:
- close button text color.
-
setCloseButtonColor
public void setCloseButtonColor(org.joml.Vector4f closeButtonColor) Used to set close button text color.- Parameters:
closeButtonColor- close button text color to set.
-
getContainer
Returns widget container that hold all other elements. Should be used to add components.- Returns:
- widget container.
-
setContainer
Used to set widget container.- Parameters:
container- widget container to set.
-
isDraggable
public boolean isDraggable()Returns true if widget could be dragged.- Returns:
- true if widget could be dragged.
-
setDraggable
public void setDraggable(boolean draggable) Used to set widget draggable or not.- Parameters:
draggable- new draggable state of widget.
-
isMinimizable
public boolean isMinimizable()Returns true if widget could be minimized (minimize button is visible).- Returns:
- true if widget could be minimized (minimize button is visible).
-
setMinimizable
public void setMinimizable(boolean minimizable) Used to make minimize button visible or not.- Parameters:
minimizable- new minimizable state of widget.
-
isMinimized
public boolean isMinimized()Returns true if widget minimized.- Returns:
- true if widget minimized.
-
setMinimized
public void setMinimized(boolean minimized) Used to minimize/maximize widget.- Parameters:
minimized- true to minimize, false to maximize.
-
hide
public void hide() -
show
public void show() -
getCloseIcon
Returns close icon that used by close button.- Returns:
- close icon that used by close button.
-
setCloseIcon
Used to set close icon to close button.- Parameters:
closeIcon- close icon to set.
-
getMaximizeIcon
Returns maximize icon that used by minimize button.- Returns:
- maximize icon that used by minimize button.
-
setMaximizeIcon
Used to set maximize icon to minimize button.- Parameters:
maximizeIcon- maximize icon to set.
-
getMinimizeIcon
Returns minimize icon that used by minimize button.- Returns:
- minimize icon that used by minimize button.
-
setMinimizeIcon
Used to set minimize icon to minimize button.- Parameters:
minimizeIcon- minimize icon to set.
-
addWidgetCloseEventListener
Used to add event listener for widget close event.- Parameters:
eventListener- event listener to add.
-
getWidgetCloseEvents
Returns all event listeners for widget close event.- Returns:
- all event listeners for widget close event.
-
removeWidgetCloseEventListener
Used to remove event listener for widget close event.- Parameters:
eventListener- event listener to remove.
-
equals
-
hashCode
public int hashCode() -
toString
-
isResizable
public boolean isResizable() -
setResizable
public void setResizable(boolean resizable) -
getResizeButton
-
isAscendible
public boolean isAscendible()Returns true if widget could ascend to the top in parent container.- Returns:
- true if widget could ascend to the top in parent container.
-
setAscendible
public void setAscendible(boolean ascendible) Set true to make widget ascend to the top in parent container on click event on widget or any component inside.- Parameters:
ascendible- new state.
-