jMonkey LorisGUI - Controls

The building blocks of the UI

Home Overview Visuals XML Style Model Controls Components Layouts
 

ViewElement

The base concrete class for all Viewables is ViewElement. It defines the foundation components used by all other controls. A ViewElement has three component layers: insets, border, background. The following apply to all controls:

alpha='floatValue'
Override the alpha value applied to all components associated with this control. The value should range from 0.0 to 1.0, with a value of -1 eliminating the alpha override.
<background>
Define the component that occupies the background layer. By default, a BackgroundComponent is created.
backgroundColor='#rrggbbaa/#rgba'
<backgroundColor r='aFloat' g='aFloat' b='aFloat' a='aFloat'/>
If <background> is not provided, then you can define a simple background color, which creates a BackgroundComponent of the given color with no margins. The color is defined by 0.0 to 1.0 aFloat values for red, green, blue, and alpha, or by the hex string where rr, gg, bb, and aa are hex digits in the range 00 to ff (or 0 to f for the short form).
<border>
Define the component that occupies the border layer. By default, a BackgroundComponent is created.
<constrainedSize x='width' y='height'>
The given size becomes the maximum allowed. If either width or height is zero, then there is no constraint in that dimension.
<constraint>
Define the layout constraint that controls the position of this control within its parent container. A Constraint is created.
NOTE that the constraint attribute values can be included directly within ViewElement definition without requiring the explicit <constraint> declaration.
elementID='string'
If defined, this element id replaces the inherent element id associated with the underlying type. It becomes part of the fully qualified selector name, and shares no attributes with the element id it replaces.
elementSubID='string'
If defined, this element id extends the inherent element id associated with the underlying type. It becomes part of the fully qualified selector name, and shares all the attributes with the base element id.
enabled='true/false'
Explicitly enable/disable this control. A disabled control will not interact with the user.
<insets>
Define the component that occupies the insets layer. By default, a InsetsComponent is created.
<hint>
Define a popup Hint for this control. By default, a Hint control is created.
preferredSize='componentname'
The inherent size of the selected component becomes the preferred size of this control. For example, if you reference 'background', then the inherent size of the background (typically based on an image) is used as the preferred size of this control.
<preferredSize x='width' y='height'>
The given size becomes the preferred size of the component. If either width or height is zero, then there is no preferred size in that dimension.
styleID='stylesheetname'
Explicitly call out the style sheet to apply to this control.
 

Button

A Button is a simple interactive control that fires an Actionable when the user clicks on it. If the Button has focus, then the Actionable is invoked on the <Enter> keystroke.

actionCode='string'
When clicked, lookup the given action code in the current GuiContext and fire the Actionable found there.
<action class='someSavable'>
When clicked, fire the Actionable defined here. Since this is an XML declaration, not Java code, you can only create Actionables that can be fully defined in XML. Currently, these are hard-coded actions (actionDialog) that open/close Dialogs.
autoRepeatMS='millisecondCount'
Auto-repeat firing the Actionable every millisecondCount so long as the mouse button is held down over the Button.
SEE ALSO:
Label, ViewElement
 

Checkbox

A CheckBox is a binary state toggle that is either active or inactive. The state is flipped on a mouse click or, if the Checkbox has focus, by the <Enter> keystroke. By default, the associated value of this control is Boolean.TRUE when active and null when inactive. These values can be reset to anything you would like.

actionCode='string'
When the state is flipped, lookup the given action code in the current GuiContext and fire the Actionable found there.
<activeValue class='someSavable'> or activeValue='astring'
<inactiveValue class='someSavable'> or inactiveValue='astring'
Set the active and inactive values to these Savables/Strings.
<dataValue class='someSavable'> or dataValue='astring'
Set the active value to this Savable/Strings. The inactive value is null.
isActive='true/false'
Set the initial active/inactive state.
SEE ALSO:
Label, ViewElement
 

Container

A Container is a parent element that organizes its children via a layout. A Container has four component layers: insets, border, background, layout. Unlike most controls, a Container does not inherently add to the fully qualified selector id. The assumption is that a container is just organizing its children, not influencing any style. Panel is a container that does add its elementID into the selector id. Or if you specify an explicit elementID for Container, then that becomes part of the selector id.

<layout class='someLayout'>
Define the layout and all child elements within the layout.
<elements>
If <layout> was not provided, then these elements become the child elements for the default layout for this container. The default layout is typically set via style processing.
SEE ALSO:
ViewElement
 

DragPanel

A DragPanel is a special container that is sensitive to the mouse click, and can be dragged by the user. The panel is dynamically moved while the mouse button is down, and retains its final position once the button is released. The orientation= attribute controls if the panel can be dragged horizontally, vertically, or freely in 2D.

orientation='None/Vertical/Horizontal
Set how can the panel be dragged.
SEE ALSO:
Container, ViewElement
 

Dialog

A Dialog is a special container that operates as a popup. It will be defined in the top of the visual hierarchy and will be included with the special layout Constraint position='Popup'. This means that the Dialog only becomes visible on explicit action. Once visible, the Dialog intercepts all mouse and key activity for its own use. It is then closed on explicit action, releasing its intercept at that time. One Dialog can open another.

<offset x='distance' y='distance'>
When opening the Dialog, adjust its position by the given distances.
SEE ALSO:
Container, ViewElement
 

DropDown

A DropDown is a text display element that shows an active entry from a given list (DropDowList) of possibilities. The list is hidden until the user clicks on the DropDown, at which point the list is opened and positioned over the DropDown. The list supports some count of visible entries, with scrolling supported if there are more entries than the given count. Clicking on an entry closes the list and changes the value displayed in the DropDown.

<dropdownList>
Create a DropDownList and populate it with entries.
SEE ALSO:
Label, ViewElement

The DropDownList defines the set of listItem for the DropDown and is only visible while the user is selecting a value.

actionCode='string'
When the active item changes, lookup the given action code in the current GuiContext and fire the Actionable found there.
alignColumns='true/false'
Control the layout of the DropDownList, where non-aligned columns means every row is independent, while aligned columns means the column boundaries cross rows.
<cellInsets>
Define special Insets that apply to every cell in the DropDownList.
columnLimit='count'
Control the layout of the DropDownList, with a limit of 1 meaning a simple vertical list, and anything greater than 1 creating adjacent columns.
<elements>
Include the list of items to display in the DropDownList. Each item is expected to have some type of textual representation that can be displayed in the DropDown.
NOTE that <elements> is not strictly required. The <listItem> that make up the list can be included directly within the <dropdownList> element.
scrollbarElementSubID='subID'
The subID to apply to the in-built scrollbar to control styling.
scrollbarPosition='East/West'
Where to position the scrollbar with a default of East.
<template class='listItem'>
Configure a template item that is cloned for each option provided by Model processing.
visibleRowLimit='rowCount'
The number of rows to display. If there are more entries than this limit, scrolling will be supported.
SEE ALSO:
ViewElement
 

Hint

A Hint is a special container that operates as a popup. It will be included within some other ViewElement, and is invisible until the mouse hovers over the parent element, unmoving for a given amount of time. The Hint will then be made visible and positioned over its parent. Once the mouse moves, the Hint is hidden once again.

While the Hint is a full container and can be as complex as desired, remember that the Hint auto-closes on any user activity, so it cannot be truely interactive.

delayMS='millisecondCount'
The mouse must remain motionless for this count of milliseconds for the Hint to be displayed.
<offset x='distance' y='distance'>
When opening the Hint, adjust its position by the given distances.
text='someMessage'
If no container layout or elements is found, then a simple text display is used to post this given message.
SEE ALSO:
Container, ViewElement
 

Label

A Label is a text display element that acts as the foundation for many other controls. Its layered components consist of: insets, border, background, icon, shadow text, text. Icon expects to be filled with an IconComponent, which is typically an image that consumes a given amount of space in the overall control. Text and shadow text share the same textual attributes, and same run of text characters, but the shadow text is of a different color and is offset a bit from the master text. This gives you a 'shadow' depth effect.

The run of text is laid out horizontally until either an explicit newline is encountered or a maximum width is exceeded. At that point, a new line is started.

charCount='aFloat'
Reserve minimal space for a given count of characters (em space). This count can be fractional since the em space can be a bit wide.
font='pathToFont'
Select the font used to display the text.
fontSize='aFloat'
The size of the font used to display the text.
<icon>
Define the component that occupies the icon layer. By default, a IconComponent is created.
lineCount='anInt'
Reserve minimal space for a given count of rows.
maxTextHeight='height'
The maximum height allowed for the text box.
maxTextWidth='width'
The maximum width allowed for the text box.
shadowColor='#rrggbbaa/#rgba'
<shadowColor r='aFloat' g='aFloat' b='aFloat' a='aFloat'>
Define the color of the shadow text.
<shadowOffset x='distance' y='distance'>
Adjust the position of the shadow text by the given distances.
<stateAdapters>
<shadowStateAdapters>
<textStateAdapters>
Define a set of state adapters that modify the text attributes as the control changes state.
suppressShadow='true/false'
If the shadow is suppressed, then the shadow text layer is not used and has no effect on the visual display.
suppressText='true/false'
If text is suppressed, then the text/shadow text layers are not used and have no effect on the visual display. The result is a visual based on icon/background/border.
text='aString'
Define the run of text characters to display in this Label. A newline can be included by the combination \n and a tab can be included by the combination \t.
textColor='#rrggbbaa/#rgba'
<textColor r='aFloat' g='aFloat' b='aFloat' a='aFloat'>
Define the color of the text.
textAlignH='Left/Center/Right'
How to align the text horizontally in its given space.
textAlignV='Top/Middle/Bottom'
How to align the text vertically in its given space.
SEE ALSO:
ViewElement
 

ListBox

A ListBox defines a set of listItems, only one of which is active. The active item supplies the value of the ListBox itself. A fixed number of list items is displayed, and if the list is longer, then scrolling through the items is supported.

actionCode='string'
When the active item changes, lookup the given action code in the current GuiContext and fire the Actionable found there.
alignColumns='true/false'
Control the layout of the ListBox, where non-aligned columns means every row is independent, while aligned columns means the column boundaries cross rows.
<cellInsets>
Define special Insets that apply to every cell in the ListBox.
columnLimit='count'
Control the layout of the ListBox, with a limit of 1 meaning a simple vertical list, and anything greater than 1 creating adjacent columns.
<elements>
Include the list of items to display in the ListBox.
NOTE that <elements> is not strictly required. The <listItem> that make up the list can be included directly within the <listBox> element.
scrollbarElementSubID='subID'
The subID to apply to the in-built scrollbar to control styling.
scrollbarPosition='East/West'
Where to position the scrollbar with a default of East.
<template class='listItem'>
Configure a template item that is cloned for each option provided by Model processing.
visibleRowLimit='rowCount'
The number of rows to display. If there are more entries than this limit, scrolling will be supported.
SEE ALSO:
ViewElement
 

Panel

A Panel is a minor variation of a container that always includes its elementID (Panel) within the fully qualified selector name. If you want layout with no impact on styling, use a Container.

 

RadioButtonGroup

A RadioButtonGroup is a specialization of a container that parents RadioButton elements. Each RadioButton is like a CheckBox, in that it is either active or inactive and displays accordingly. But all RadioButtons coordinate with their parent group so that only one button is active at a time.

The RadioButtonGroup has a layout, and the individual RadioButtons are added to the group just like any child is added to a container. However, it is possible for application Model processing to define the desired set of options within the group. To this end, rather than declaring hard-coded RadioButton children, you can define a template that will be cloned so support each option provided by the Model.

actionCode='string'
When the active button changes, lookup the given action code in the current GuiContext and fire the Actionable found there.
<elements>
Include the list of RadioButtons to display in this group.
NOTE that <elements> is not strictly required. The <radioButton> that make up the children can be included directly within the <radioButtonGroup> element.
<template class='radioButton'>
Configure a template button that is cloned for each option provided by Model processing.
SEE ALSO:
ViewElement

Each RadioButton is very much like a CheckBox, either in an active or inactive state. It has an associated data 'value', which becomes the value of the overall RadioButtonGroup when it is active.

<dataValue class='someSavable'> or dataValue='aString'
Set the active value to this Savable/String.
isActive='true/false'
Set the initial active/inactive state.
SEE ALSO:
Label, ViewElement
 

Screen

A Screen is a specialization of a container that has a special size and position. All controls, even normal containers, take there size and position from the layout processing of their parent control. But you have to start somewhere, so you start with a Screen.

By definition, a Screen is positioned in the upper left of the display (0,0) and has a width/height that matches the physical display width/height. As a container, it has a layout that arranges its children within those bounds.

In 3D rendering, a Screen has a bit more flexibility. You can set the explicit origin and adjust scaling. And preferredSize will override the defaults taken from the physical screen.

scale='aFloat'
(3D only) Scaling factor to apply to the overall Screen.
<origin x='xCoord' y='yCoord' z='zCoord'>
(3D only) Set the origin of the Screen.
SEE ALSO:
Container, ViewElement
 

ScrollPanel

A ScrollPanel is a custom container that has a limited height (based on a count of rows) and the ability to scroll when there are more layout rows than the given height.

alignColumns='true/false'
Control the layout of the ScrollPanel, where non-aligned columns means every row is independent, while aligned columns means the column boundaries cross rows.
<cellInsets>
Define special Insets that apply to every cell in the ScrollPanel.
columnLimit='count'
Control the layout of the ScrollPanel, with a limit of 1 meaning a simple vertical list, and anything greater than 1 creating adjacent columns.
<elements>
Include the list of items to display in the ScrollPanel.
NOTE that <elements> is not strictly required. The Viewables that make up the list can be included directly within the <scrollPanel> element.
scrollbarElementSubID='subID'
The subID to apply to the in-built scrollbar to control styling.
scrollbarPosition='East/West'
Where to position the scrollbar with a default of East.
visibleRowLimit='rowCount'
The number of rows to display. If there are more entries than this limit, scrolling will be supported.
SEE ALSO:
Container, ViewElement
 

Slider

A Slider is a control with a thumb that can be dragged from one extreme to another. The value of the Slider is the percentage of the distance spanned. End points of the Slider can act as buttons that move the thumb when pressed. The Slider can be oriented either horizontally or vertically (and just for grins, neither/both where the thumb can be dragged in 2D, adjusting both an x and y percentage at the same time)

The details of the Slider appearance are left to the styling applied. A Slider can be configured to look like a volume control, or a scroll bar. The Slider can be configured to render Model supplied text in the end point buttons, and can dynamically display a changing value within the thumb itself.

actionCode='string'
When the thumb finishes moving, lookup the given action code in the current GuiContext and fire the Actionable found there.
alwaysSignal='true/false'
If false, the action is only signaled when the mouse button is released and the thumb motion stops. If true, the action is signaled with every change of the thumb position.
<decrement class='somecontrol'>
Provide the control that occupies the minimal end point. If this control is interactive, it serves as a button to move the thumb.
deltaMotion='aFloat'
Set how much the thumb is moved when an end point button is clicked. This value is a count of pixels to move the visual display of the thumb.
flipEnds='true/false'
A default Slider has its largest value at the top or to the right. You can flip this by setting flipEnds='true'.
<increment class='somecontrol'>
Provide the control that occupies the maximum end point. If this control is interactive, it serves as a button to move the thumb.
orientation='None/Vertical/Horizontal'
Set how the thumb can be dragged within the slider.
<thumb>
Define the control used as the thumb. If not provided, a simple rectangular box is used.
thumbPosition='aFloat'
<thumbPosition class='range'>
Set the position of the thumb, either as a percentage of the overall distance, or to some explicitly defined range.
thumbSpan='aFloat'
Define the size of the thumb as a percentage of the size of the overall slider. This is used to indicate how much scrolling is available to the end user, as when scrolling a block of text.
SEE ALSO:
ViewElement
 

TabGroup

A TabGroup is a specialization of a container that parents a set of Tab elements. Each Tab is a combination of text display element (the visual tab) and a tab panel which is a container with its own children. The visual Tabs form a static display, but all tab panels overlay each other, with only a single tab panel being visible at a time. The size of the TabGroup is determined by the fixed size of the Tabs, plus a large enough space to display the biggest tab panel.

actionCode='string'
When the active tab changes, lookup the given action code in the current GuiContext and fire the Actionable found there.
<elements>
Include the list of tabs that make up the TabGroup.
NOTE that <elements> is not strictly required. The <tab> that make up the children can be included directly within the <tabGroup> element.
<tabLayout class='layoutClass'>
The layout that holds the Tab visual elements.
tabPosition='North/South/East/West'
The position of where the Tab visual elements are placed.
SEE ALSO:
ViewElement

Each Tab is similar to a RadioButton, in that only a single Tab is active at a time. The Tabs coordinate with the TabGroup to select which tab panel is visible.

<tabPanel class='someContainer>
Define the container that is displayed when its parent Tab is active.
SEE ALSO:
Label, ViewElement
 

TextBlock

A TextBlock is a multi-line display of text, with a scrollbar that activates if there is more text than what will fit in the given visual area. The text display itself is via TextString and the assumption is that you will apply styling via the selector TextBlock.TextString. You can also provide your own <textElement>.

scrollbarElementSubID='subID'
The subID to apply to the in-built scrollbar to control styling.
scrollbarPosition='East/West'
Where to position the scrollbar with a default of East.
scrollByRow='true/false'
If true, then scrolling jumps row-by-row. If false, then scrolling is pixel based.
<stringField>
Use a StringField to provide the initial text and select which position within the text is kept visible to the user.
text='display this string'
The text displayed in this text block. The character sequence \n is treated as a line break, and the sequence \t is a tab.
<textElement>
Provide your own custom text display element to contain/display the text of the block. A TextString will be used if nothing explicit is defined.
visibleRowLimit='rowCount'
Count of text lines that are visible. If zero, then all lines are visible. If more lines exist than this limit, then the scrollbar is activated.
SEE ALSO:
ViewElement
 

TextEntry

TextEntry is an interactive control that allows the user to type-in text. When this control has focus, a text cursor will be displayed showing the text insert point. The cursor can be repositioned by the mouse or by standard, directional keystrokes. If the text is larger than the display area, then it will be scrolled to keep the cursor visible.

Callbacks can be triggered on every keystroke, or only when editing is considered to be 'complete'. Currently, the editing is complete when focus is lost, or upon the explicit keystroke <Shift ENTER>.

actionCode='string'
When the editing action is complete, lookup the given action code in the current GuiContext and fire the Actionable found there.
alwaysSignal='true/false'
If true, signal the Actionable on every keystroke, not just when editing is complete.
charCount='aFloat'
Reserve minimal space for a given count of characters (em space). This count can be fractional since the em space can be a bit wide.
font='pathToFont'
Select the font used to display the text.
fontSize='aFloat'
The size of the font used to display the text.
lineCount='anInt'
Reserve minimal space for a given count of rows.
maxTextHeight='height'
The maximum height allowed for the text box.
maxTextWidth='width'
The maximum width allowed for the text box.
<textStateAdapters>
Define a set of state adapters that modify the text attributes as the control changes state.
text='aString'
Define the run of text characters to display in this Label. A newline can be included by the combination \n and a tab can be included by the combination \t.
textColor='#rrggbbaa/#rgba'
<textColor r='aFloat' g='aFloat' b='aFloat' a='aFloat'>
Define the color of the text.
textAlignH='Left/Center/Right'
How to align the text horizontally in its given space.
textAlignV='Top/Middle/Bottom'
How to align the text vertically in its given space.
SEE ALSO:
ViewElement
 

TextString

A TextString is a simple display of a run of text characters. It is similar to Label, but does not support an icon or shadow text.

charCount='aFloat'
Reserve minimal space for a given count of characters (em space). This count can be fractional since the em space can be a bit wide.
font='pathToFont'
Select the font used to display the text.
fontSize='aFloat'
The size of the font used to display the text.
lineCount='anInt'
Reserve minimal space for a given count of rows.
maxTextHeight='height'
The maximum height allowed for the text box.
maxTextWidth='width'
The maximum width allowed for the text box.
<stringField>
Use a StringField to provide the initial text and select which position within the text is kept visible to the user.
text='aString'
Define the run of text characters to display in this Label. A newline can be included by the combination \n and a tab can be included by the combination \t.
textAlignH='Left/Center/Right'
How to align the text horizontally in its given space.
textAlignV='Top/Middle/Bottom'
How to align the text vertically in its given space.
textColor='#rrggbbaa/#rgba'
<textColor r='aFloat' g='aFloat' b='aFloat' a='aFloat'>
Define the color of the text.
<textStateAdapters>
Define a set of state adapters that modify the text attributes as the control changes state.
SEE ALSO:
ViewElement