Members

(constant) BorderStyle :string

Border style enum. Use in a border object..

Type:
  • string
Properties
NameTypeDescription
Nonestring

No border.

Linestring

Solid line.

Dashedstring

Dashed border.

Metalstring

Metallic style.

EtchedRaisedstring

Etched raised border.

EtchedLoweredstring

Etched lowered border.

BevelRaisedstring

Bevel raised border.

BevelLoweredstring

Bevel lowered border.

SoftRaisedstring

Soft raised border.

SoftLoweredstring

Soft lowered border.

Example
<h2>Setting a new border:</h2>
let border = {style: BorderStyle.Dashed, size: 2, color: "#002288"}
panel.border(border);

(constant) Cursor :number

Enum for available mouse cursors.

Type:
  • number
Properties
NameTypeDescription
Defaultnumber

Default cursor.

Crosshairnumber

Crosshair.

Textnumber

Text input cursor.

Waitnumber

Wait/busy cursor.

ResizeSWnumber

Resize south-west.

ResizeSEnumber

Resize south-east.

ResizeNWnumber

Resize north-west.

ResizeNEnumber

Resize north-east.

ResizeNnumber

Resize north.

ResizeSnumber

Resize south.

ResizeWnumber

Resize west.

ResizeEnumber

Resize east.

Handnumber

Pointing hand.

Movenumber

Move cursor.

Example
<h2>Sets "Wait" cursor to Panel component:</h2>
panel.cursor(Cursor.Wait);

(constant) DataType :string

Enum for data types used with drag and drop. Used with dragDataType(), dropDataType(), and to check if certain data type was dragged onto component.

Type:
  • string
Properties
NameTypeDescription
Nonestring

No data.

Allstring

Accept any type. Used only for dropDataType().

Textstring

Plain text.

HTMLstring

HTML content.

Imagestring

Image data.

FileListstring

Files from system clipboard or drag.

URIListstring

List of URIs.

URLstring

A single URL string.

JSONstring

JSON-encoded data.

Componentsstring

UI components (component/*).

Examples
<h2>Sets the type of data list items represent when dragged:</h2>
list.dragDataType(DataType.FileList);
<h2>Sets the type of data Table component accepts:</h2>
table.dropDataType([DataType.FileList, DataType.URIList, DataType.URL]);
<h2>Check if expected data type was dragged onto Label:</h2>
label.dropAction(DragDropAction.CopyOrMove).dropDataType(DataType.FileList).onDropEvents(e => {
 if(e.type === "drop" && Array.isArray(e.data[DataType.FileList]))
 {
     // set first file as label's icon image
     e.target.icon(e.data[DataType.FileList][0]);
 }
});

(constant) DragDropAction :string

Enum for drag and drop actions. Used with dragAction() and dropAction().

Type:
  • string
Properties
NameTypeDescription
Nonestring

No action.

Copystring

Copy action.

Movestring

Move action.

CopyOrMovestring

Copy or move action.

Linkstring

Link action.

Example
list.dragAction(DragDropAction.CopyOrMove);
list.dropAction(DragDropAction.CopyOrMove);

(constant) DropMode :string

Used with dropMode() in Table, List, and Tree

Type:
  • string
Properties
NameTypeDescription
Onstring

Drop on items.

Insertstring

Insert between items

OnOrInsertstring

Drop on items and between items

See
  • List.dropMode()
  • Table.dropMode()
  • Tree.dropMode()
Example
table.dropMode(DropMode.OnOrInsert);

(constant) FontFamily :string

An enum for generic font family names to use instead of a font name that may not be installed on target operating systems. Use with component.font(), Text() shape, font property of a List item, Tree item, ComboBox item, Table column, and everywhere else where font can be set.

Type:
  • string
Properties
NameTypeDescription
Serifstring

Proportional font with small decorative strokes at the ends of letters (e.g., Times New Roman, Georgia, Garamond, Cambria.).

SansSerifstring

Proportional font without decorative strokes; clean and modern (e.g., Arial, Helvetica, Verdana, Calibri, Open Sans).

Monospacedstring

Fixed-width font where every character has the same width (e.g., Courier New, Consolas, Lucida Console, Menlo).

Cursivestring

Flowing, handwritten-style font (e.g., Brush Script, Comic Sans MS, Pacifico, Lobster).

Systemstring

The system UI font provided by the operating system. (e.g., Segoe UI (Windows), San Francisco (macOS/iOS), Roboto (Android/Linux)).

Fantasystring

Decorative or themed font (e.g., Impact, Papyrus, Jokerman, Copperplate).

Examples
<h2>Setting component font:</h2>
textarea.font({name: FontFamily.SansSerif});
<h2>Setting Text shape font:</h2>
let text = new Text("Hello World", {name: FontFamily.Fantasy, size: 30});

(constant) KeyAction :number

Keyboard key actions. Used with ui.keyboardAction(action, value) to perform key actions.

Type:
  • number
Properties
NameTypeDescription
Pressnumber

Key press.

Releasenumber

Key release.

Typenumber

Key typed (typed character input).

Example
<h2>Performing a key type action:</h2>
ui.keyboardAction(KeyAction.Type, "A");

(constant) LineWrap :number

Enum for word wrapping styles. Used with lineWrap() method in TextArea and DocumentEditor to control how text is wrapped.

Type:
  • number
Properties
NameTypeDescription
Nonenumber

Disable line wrapping.

Wordnumber

Wrap line when a full word doesn't fit.

Characternumber

Wrap line when a character doesn't fit.

Example
<h2>Setting line wrapping style:</h2>
textarea.lineWrapping(LineWrap.Word);

(constant) MessageIcon :number

Enum for standard message dialog icons. Used in alert(), dialog() and TrayIcon.showNotification().

Type:
  • number
Properties
NameTypeDescription
Errornumber

Error icon.

Infonumber

Information icon.

Warningnumber

Warning icon.

Questionnumber

Question icon.

Example
alert("This file doesn't exist!", "File Absent", MessageIcon.Warning);

(constant) MouseAction :number

Enum for mouse actions. Used with ui.mouseAction(action, button).

Type:
  • number
Properties
NameTypeDescription
Pressnumber

Mouse button press.

Releasenumber

Mouse button release.

Clicknumber

Single click.

DoubleClicknumber

Double click.

VerticalScrollnumber

Vertical wheel scroll.

HorizontalScrollnumber

Horizontal wheel scroll.

Example
<h2>Performing a mouse click:</h2>
ui.mouseAction(MouseAction.Click, MouseButton.Left);

(constant) MouseButton :number

Enum for mouse buttons. Compare to mouseEvent.button on mouse events or use with ui.mouseAction(action, button).

Type:
  • number
Properties
NameTypeDescription
Leftnumber

Left mouse button.

Rightnumber

Right mouse button.

Middlenumber

Middle mouse button.

Examples
<h2>Checking if right mouse button was clicked:</h2>
if(mouseEvent.button === MouseButton.Right)
{
    console.log("Right click);
}
<h2>Performing a mouse click:</h2>
ui.mouseAction(MouseAction.Click, MouseButton.Left);

(constant) Orientation :number

Enum for component orientation, such as Slider or Toolbar.

Type:
  • number
Properties
NameTypeDescription
Horizontalnumber

Horizontal orientation.

Verticalnumber

Vertical orientation.

Example
<h2>Setting orientation to a component:</h2>
toolbar.orientation(Orientation.Vertical);

(constant) SelectionMode :number

Enum for selection modes in UI components like Table, List, Tree. Used with selectionMode() to set of get a selection mode of a list of items or rows.

Type:
  • number
Properties
NameTypeDescription
Singlenumber

Single item selection.

Rangenumber

Range selection (shift-click).

Multiplenumber

Multiple selection (ctrl/cmd-click).

Example
table.selectionMode(SelectionMode.Single);

(constant) TextAction :number

Enum for actions on text components (TextField, TextArea, etc.). To be used in text() method.

Type:
  • number
Properties
NameTypeDescription
Setnumber

Replace all text.

Prependnumber

Add text at the beginning.

Appendnumber

Add text at the end.

Insertnumber

Insert at current caret position.

ReplaceSelectionnumber

Replace selected text.

Example
<h2>Appending text to TextArea component:</h2>
let textarea = new TextArea("Hello").text(" World!", TextAction.Append);
// text area will contain text "Hello World!"

(readonly) ui :SwingUI

This is a global instance of the main SwingUI class. Use this variable to call functions of SwingUI class.

Type:
Example
let _screens = ui.screens; // enumerates screens in Array
const data = ui.clipboard(); // retrieves data copied to clipboard

Methods

alert(message, titleopt, iconopt, ownerWindowopt) → {void}

Displays a dialog window with a specified error message and an error icon.

Parameters:
NameTypeAttributesDefaultDescription
messagestring

A message to be displayed in the dialog window

titlestring<optional>
"Message"

Dialog window title bar text

iconMessageIcon<optional>
MessageIcon.Info

Icon to show in the dialog window.

Valid value are:

  • MessageIcon.Error
  • MessageIcon.Info
  • MessageIcon.Warning
  • MessageIcon.Question
ownerWindowWindow<optional>
null

If set, the message dialog window will attempts to be centered at specified window

Returns:

Does not return a value

Type: 
void
Examples
<h2>Simple usage with only one parameter:</h2>
alert("File name is invalid. Please try again");
<h2>Usage example when passing all parameters:</h2>
alert("File name is invalid. Please try again","Invalid File", MessageIcon.Warning, this);

confirm(message, windowopt) → {boolean}

Displays a confirmation dialog to user and returns user's response as boolean.

Parameters:
NameTypeAttributesDefaultDescription
messagestring

Message to display to user

windowWindow<optional>
null

Window which dialog window will overlay.

Returns:

Returns true if user confirms the message, or false otherwise.

Type: 
boolean
Example
if(confirm("Delete this file?", this))
{
    // delete code
}

dialog(message, titleopt, buttonsopt, iconopt, windowopt) → {string|undefined}

Shows a custom dialog window that allows the user to respond by clicking one of provided buttons.

Parameters:
NameTypeAttributesDefaultDescription
messagestring

String message to user. It can be plain text or HTML.

titlestring<optional>
""

Dialog window title shown in the title bar of the window

buttonsstring<optional>
"OK|Cancel"

A string of button names separated by "|" character. Indicate which button should be selected by default by surrounding the button with square brackets like so: "OK|[Cancel]"

iconMessageIcon | string<optional>
null

One of MessageIcon icons, or an absolute path to an image from a file system.

windowWindow<optional>
null

Owner window that will be overlaid by this dialog window.

Returns:

Returns a string of the clicked button, or undefined if user close the window without clicking on one of provided buttons.

Type: 
string | undefined
Example
let response = dialog("Are you ready?", "Confirm readiness", "Yes|No|[Maybe]", MessageIcon.Question, this);
if(response !== "Yes") return; // do not continue

let response = dialog("Is this you?", "Question #5", "Yes|[No]", "C://User/John/profile_icon.jpg", this);

error(message, show_stack_traceopt) → {void}

Displays a dialog windows with error message and error icon.

Parameters:
NameTypeAttributesDefaultDescription
messagestring

Error message to display.

show_stack_traceboolean<optional>
true

Whether to show stack trace to be able to trace the error.

Returns:

Does not return a value

Type: 
void
Examples
<h2>Showing an error message only:</h2>
error("Invalid parameters passed.", false);
<h2>Showing an error message with a stack trace:</h2>
error("Invalid parameters passed.");

isAbsolutePath(path) → {boolean}

Checks if the provided path is absolute (mainly for the purpose to know if a directory should be prepended to the path to make it absolute). Note that it returns true for empty string.

Parameters:
NameTypeDescription
pathstring

File path (supports local files, network drive paths, Windows paths with drive letter, unix root /)

Throws:

Throws error if provided path is not a string type.

Type
Error
Returns:

Returns true if the path is absolute or an empty string.

Type: 
boolean

prompt(message, default_valueopt, ownerWindowopt) → {string|undefined}

Requests user for text input in a dialog window. Returns a string as user's input or undefined when user declined to input.

Parameters:
NameTypeAttributesDefaultDescription
messagestring

Message to user about this text input.

default_valuestring<optional>
""

Default string that will be already present in the dialog window.

ownerWindowWindow<optional>
null

Window that will be overlaid by the dialog window.

Returns:

Returns user provided string, or undefined if user canceled input.

Type: 
string | undefined
Example
let response = prompt("Please enter your name:", "John Doe", this);
console.log("You entered: " + response);

Type Definitions

ActionEvent

Action event received by the onAction() handler callback.

Type:
  • Object
Properties
NameTypeAttributesDescription
targetobject

The component that triggered the event.

commandstring

The command string, usually the button text or a custom value set with .command("").

modifiersnumber<optional>

Keyboard modifiers (bitmask or flags).

altboolean<optional>

Indicates if ALT key was pressed.

shiftboolean<optional>

Indicates if SHIFT key was pressed.

ctrlboolean<optional>

Indicates if CTRL key was pressed.

typestring

One of action or index_change. Present when applicable.

xnumber<optional>

Mouse X position relative to the component.

ynumber<optional>

Mouse Y position relative to the component.

screenXnumber<optional>

Mouse X position relative to the screen.

screenYnumber<optional>

Mouse Y position relative to the screen.

interactiveboolean<optional>

Indicates if the action was triggered by user interaction (not programmatically).

selectedboolean<optional>

Indicates selection state when applicable.

AncestorEvent

Ancestor event received by the onAncestorEvents() handler callback.

Type:
  • Object
Properties
NameTypeDescription
targetobject

The component that triggered the event.

typestring

One of add, remove, move.

ancestorobject

The ancestor component related to this event.

AudioDevice

Represents an audio input or output device, such as a microphone, audio card, etc.

Type:
  • Object
Properties
NameTypeAttributesDescription
namestring

Name of the audio device (required when setting an audio input device).

idstring<optional>

ID of the audio device.

formatsArray.<AudioFormat><optional>

List of available audio formats provided when retrieving a list of installed audio devices.

formatAudioFormat<optional>

Specifies the chosen audio format to use when setting audio input device.

AudioFormat

Represents an audio format for an audio device.

Type:
  • Object
Properties
NameTypeAttributesDescription
channelsnumber

Number of audio channels. (1-Mono, 2-Stereo, etc.)

bitsnumber

Bits per audio sample.

ratenumber<optional>

Sample rate in Hz (only available for audio input devices).

encodingstring<optional>

Audio encoding (e.g., "PCM_UNSIGNED", "PCM_SIGNED"); (only available for audio output device formats).

AudioStream

Describes an audio stream in the media.

Type:
  • Object
Properties
NameTypeDescription
sampleRatenumber

Sample rate of the audio stream in Hz.

channelsnumber

Number of audio channels (1 - mono, 2 - stereo, etc.)

bitDepthnumber

Bit depth of the audio samples.

codecstring

Codec used to encode the audio stream (e.g., "aac").

defaultboolean

Indicates if this is the default audio stream.

CaretEvent

Caret event received by the onCaretEvents() handler callback.

Type:
  • Object
Properties
NameTypeAttributesDescription
targetobject

The component that triggered the event.

typestring

Always change.

positionnumber

The new caret position.

selectionStartnumber

Start position of selected text.

selectionEndnumber

End position of selected text.

linenumber<optional>

Line number where the caret is located. Present in components like DocumentEditor.

columnnumber<optional>

Column number (offset from line start) of the caret. Present in multi-line components like DocumentEditor.

stylesobject<optional>

Text formatting information at the caret’s position. Present only for DocumentEditor when HTML is enabled.

pathArray.<string><optional>

HTML tag hierarchy at the caret’s position. Present only for DocumentEditor when HTML is enabled.

ChangeEvent

Change event received by the onChange() handler callback.

Type:
  • Object
Properties
NameTypeAttributesDescription
targetobject

The component that triggered the event.

typestring

One of change, changing. change - when value has changed and is no longer being modified by the user. changing - when the value is still being modified, e.g. while moving a Slider knob.

actionstring<optional>

One of inserted, removed. Present for some text editing components, indicates the action performed.

positionnumber<optional>

The position at which text was inserted. Present when action is present.

lengthnumber<optional>

The number of characters inserted or removed. Present when action is present.

ComponentEvent

Component event received by the onComponentEvents() handler callback.

Type:
  • Object
Properties
NameTypeAttributesDescription
targetobject

The component that triggered the event.

typestring

One of resize, move, show, hide.

interactiveboolean<optional>

Indicates if the event was triggered by user interaction (not programmatically). Present for move and resize for component like Window, InternalWindow.

xnumber<optional>

New X position of the component.

ynumber<optional>

New Y position of the component.

widthnumber<optional>

New width of the component. Present when type is resize.

heightnumber<optional>

New height of the component. Present when type is resize.

innerWidthnumber<optional>

New width of the content area. Present for resize when component is Window or InternalWindow.

innerHeightnumber<optional>

New height of the content area. Present for resize when component is Window or InternalWindow.

ContainerEvent

Container event received by the onContainerEvents() handler callback.

Type:
  • Object
Properties
NameTypeDescription
targetobject

The container component that triggered the event.

typestring

One of add, remove.

childobject

The child component that was added or removed.

DisposeEvent

A dispose event object received by the onDispose() handler callback when a component gets disposed.

Type:
  • Object
Properties
NameTypeDescription
targetobject

The component that triggered the event.

DragEvent

Drag event received by the onDragEvents() handler callback.

Type:
  • Object
Properties
NameTypeAttributesDescription
targetobject

The component that triggered the event.

typestring

One of dragstart, dragend, cancel.

actionstring<optional>

One of the values of enum DragDropAction. Present when applicable.

xnumber<optional>

X position of the pointer relative to this component. Present when type is dragstart or dragend.

ynumber<optional>

Y position of the pointer relative to this component. Present when type is dragstart or dragend.

screenXnumber<optional>

X position of the pointer relative to the screen. Present when type is dragstart or dragend.

screenYnumber<optional>

Y position of the pointer relative to the screen. Present when type is dragstart or dragend.

buttonnumber<optional>

Indicates a pointing device button involved in dragging. Value of MouseButton enum.

modifiersnumber<optional>

Keyboard modifiers (bitmask or flags). Present when type is dragstart.

modifiersTextstring<optional>

Human-readable keyboard modifiers. Present when type is dragstart.

altboolean<optional>

Indicates if ALT key was pressed. Present when type is dragstart.

shiftboolean<optional>

Indicates if SHIFT key was pressed. Present when type is dragstart.

ctrlboolean<optional>

Indicates if CTRL key was pressed. Present when type is dragstart.

selectedArray.<number><optional>

Selected indexes of a List component whose items are being dragged. Present only when dragging List items.

DropEvent

Drop event received by the onDropEvents() handler callback.

Type:
  • Object
Properties
NameTypeAttributesDescription
targetobject

The component that triggered the event.

typestring

One of dragenter, dragover, dragleave, drop.

actionstring<optional>

One of the values of enum DragDropAction. Present when applicable.

dataobject<optional>

Contains the data being dropped. Present only when type is drop or dragenter.

sourceobject<optional>

The component being dragged onto this component. Present only for component-to-component drag and when DataType.Component is allowed.

xnumber<optional>

X position of the pointer relative to this component. Present when type is dragstart or drop.

ynumber<optional>

Y position of the pointer relative to this component. Present when type is dragstart or drop.

screenXnumber<optional>

X position of the pointer relative to the screen. Present when type is dragstart or drop.

screenYnumber<optional>

Y position of the pointer relative to the screen. Present when type is dragstart or drop.

selectedArray.<number><optional>

Selected indexes of a List component whose items are being dragged. Present only when dragging List items.

ErrorEvent

An error event object received by the onError() handler callback when error occurs.

Type:
  • Object
Properties
NameTypeDescription
targetobject

The component that triggered the event.

messsagestring

An error message.

FocusEvent

Focus event received by the onFocusEvents() handler callback.

Type:
  • Object
Properties
NameTypeDescription
targetobject

The component that triggered the event.

typestring

One of focus, blur.

causestring

One of UNKNOWN, ACTIVATION, TRAVERSAL_FORWARD, TRAVERSAL_BACKWARD.

temporaryboolean

Identifies if the focus change is temporary or permanent.

Font

Font object used in most UI components, ListItem, TableColumn, Text shape and other text-rendering components.

Type:
  • Object
Properties
NameTypeAttributesDescription
namestring | FontFamily<optional>

Font family name (e.g., "sans-serif").

sizenumber<optional>

Font size in pixels.

boldboolean<optional>

Whether the text is bold.

italicboolean<optional>

Whether the text is italic.

underlinedboolean<optional>

Whether the text is underlined.

strikethroughboolean<optional>

Whether the text has a strikethrough.

directionstring<optional>

Text direction: "ltr" or "rtl".

kerningboolean<optional>

Enable or disable kerning.

ligaturesboolean<optional>

Enable or disable font ligatures.

trackingnumber<optional>

Letter spacing adjustment: -1, 0 (default), or 1.

KeyEvent

Key event received by the onKey() handler callback.

Type:
  • Object
Properties
NameTypeAttributesDescription
targetobject

The component that triggered the event.

typestring

One of up, down, type.

keyCodenumber

Numeric code associated with the key.

extendedKeyCodenumber

Unique id assigned to a key depending on the current keyboard layout.

keyCharstring

The character produced by the key.

modifiersnumber<optional>

Keyboard modifiers (bitmask or flags).

modifiersTextstring<optional>

Human-readable representation of modifiers.

altboolean<optional>

Indicates if ALT key was pressed.

shiftboolean<optional>

Indicates if SHIFT key was pressed.

ctrlboolean<optional>

Indicates if CTRL key was pressed.

keyLocationstring<optional>

One of standard, numpad, left, right. Present for up and down events.

LinkEvent

Event object passed to hyperlink event handlers in DocumentEditor#onLinkEvents.

Type:
  • Object
Properties
NameTypeDescription
targetDocumentEditor

The component that triggered the event.

typestring

The event type: click, mouseenter, or mouseleave.

urlstring

The href attribute of the <a> tag.

textstring

The text content of the hyperlink.

shiftboolean

Whether the Shift key was pressed.

ctrlboolean

Whether the Ctrl key was pressed.

altboolean

Whether the Alt key was pressed.

modifiersstring

Keyboard modifiers mask.

modifiersTextstring

String representation of the keyboard modifiers.

ListItem

Item object used in ComboBox, List, and Tree components.

Type:
  • Object
Properties
NameTypeAttributesDescription
textstring<optional>

Item text. (Required for a new list item).

idstring | number<optional>

Value that can be used by software logic to identify this item.

valuestring | number<optional>

Additional value to be stored in the item for later use.

iconstring | null<optional>

Absolute/relative path to icon image, base64 encoded image string, or null to remove icon.

colorstring<optional>

Item text color as a 6-character hex string (e.g. #665500).

backgroundstring<optional>

Item background color as a 6-character hex string (e.g. #665500).

tooltipstring<optional>

Tooltip text shown when hovering the item (only in List and Tree components).

fontFont<optional>

Font formatted object.

Media

Describes metadata and streams of the media.

Type:
  • Object
Properties
NameTypeAttributesDescription
durationnumber<optional>

Duration of the media in seconds. Not present for live streams.

videoStreamsArray.<VideoStream>

Array of video streams available in the media.

audioStreamsArray.<AudioStream>

Array of audio streams available in the media.

subtitleStreamsArray.<SubtitleStream>

Array of subtitle streams available in the media.

MouseEvent

Mouse event received by the onMouseEvents() handler callback.

Type:
  • Object
Properties
NameTypeAttributesDescription
targetobject

The component that triggered the event.

typestring

One of click, down, up, enter, leave.

buttonnumber

Button number. One of MouseButton enum values.

clicksnumber<optional>

Number of times the button was clicked. Present when applicable.

modifiersnumber<optional>

Keyboard modifiers (bitmask or flags).

altboolean<optional>

Indicates if ALT key was pressed.

shiftboolean<optional>

Indicates if SHIFT key was pressed.

ctrlboolean<optional>

Indicates if CTRL key was pressed.

xnumber<optional>

Mouse X position relative to the component. Present when applicable.

ynumber<optional>

Mouse Y position relative to the component. Present when applicable.

screenXnumber<optional>

Mouse X position relative to the screen. Present when applicable.

screenYnumber<optional>

Mouse Y position relative to the screen. Present when applicable.

MouseMotionEvent

Mouse motion event received by the onMouseMotion() handler callback.

Type:
  • Object
Properties
NameTypeAttributesDescription
targetobject

The component that triggered the event.

typestring

One of move, drag.

buttonnumber<optional>

Button number. One of MouseButton enum values. Present when applicable.

modifiersnumber<optional>

Keyboard modifiers (bitmask or flags).

xnumber

Mouse X position relative to the component.

ynumber

Mouse Y position relative to the component.

screenXnumber

Mouse X position relative to the screen.

screenYnumber

Mouse Y position relative to the screen.

MouseWheelEvent

Mouse wheel event received by the onMouseWheel() handler callback.

Type:
  • Object
Properties
NameTypeAttributesDescription
targetobject

The component that triggered the event.

typestring

Always wheel.

buttonnumber<optional>

Button number. One of MouseButton enum values. Present when applicable.

scrollAmountnumber

Number of units to scroll per wheel click.

rotationnumber

Number of wheel "clicks" rotated. Can be zero until a full click is accumulated on high-resolution wheels.

modifiersnumber<optional>

Keyboard modifiers (bitmask or flags).

altboolean<optional>

Indicates if ALT key was pressed.

shiftboolean<optional>

Indicates if SHIFT key was pressed.

ctrlboolean<optional>

Indicates if CTRL key was pressed.

xnumber

Mouse X position relative to the component.

ynumber

Mouse Y position relative to the component.

screenXnumber

Mouse X position relative to the screen.

screenYnumber

Mouse Y position relative to the screen.

PlayerEvent

Event object passed to MediaPlayer event handlers.

Type:
  • Object
Properties
NameTypeAttributesDescription
typestring

Indicates the type of event triggered by the player. One of: loadstart, loadedmetadata, seeking, timeupdate, play, stop.

mediaTypestring<optional>

Type of media loaded in the player. One of: File, InputDevice, URL.

mediaMedia<optional>

A Media object containing details about the loaded media.

currentTimenumber<optional>

Current playback time in seconds.

durationnumber<optional>

Total duration of the media in seconds. Present when type is timeupdate.

reasonstring<optional>

Reason for stopping playback. One of: Control, EndOfMediaFile, EndOfAudioStream, EndOfVideoStream, EndOfErrorStream, Error.

Point

Represents a point in 2D space with X and Y coordinates. Used when setting or getting position of UI component, Shape position, or Shape's anchor.

Type:
  • Object
Properties
NameTypeDescription
xnumber

The x-coordinate.

ynumber

The y-coordinate.

Example
<h2>Example of a Point object:</h2>
const point = {x: 300, y: 200};

PopupEvent

Popup list event received by the onPopupEvents() handler callback in ComboBox, Menu and ContextMenu components.

Type:
  • Object
Properties
NameTypeAttributesDescription
targetobject

The component that triggered the event.

typestring

One of show, hide, cancel.

xnumber<optional>

Component's X position relative to invoker. For Menu component it's only present when invoker is not null.

ynumber<optional>

Component's Y position relative to invoker. For Menu component it's only present when invoker is not null.

interactiveboolean

Indicates if the popup was triggered by user's interaction (not programmatically).

screenXnumber<optional>

X position of a Menu component relative to default screen.

screenYnumber<optional>

Y position of a Menu component relative to default screen.

invokerobject<optional>

UI Component that invoked the popup, or null if it was invoked programmatically.

PropertyChangeEvent

Property change event received by the onPropertyChange() handler callback.

Type:
  • Object
Properties
NameTypeDescription
targetobject

The component that triggered the event.

typestring

Always change.

propertystring

The property that was changed.

oldValueany

Previous value of the changed property.

newValueany

New value of the changed property.

ScrollEvent

Scroll event received by the onScroll() handler callback.

Type:
  • Object
Properties
NameTypeDescription
targetobject

The component that triggered the event.

typestring

One of horizontal, vertical.

xnumber

The new horizontal scroll position.

ynumber

The new vertical scroll position.

maxXnumber

The maximum horizontal scroll position.

maxYnumber

The maximum vertical scroll position.

Size

Represents the size of a 2D object. Used when setting or getting the size of UI component, Shape size, and more.

Type:
  • Object
Properties
NameTypeDescription
widthnumber

The width dimension.

heightnumber

The height dimension.

Example
<h2>Example of a Size object:</h2>
const size = {width: 300, height: 200};

SubtitleStream

Describes a subtitle stream in the media.

Type:
  • Object
Properties
NameTypeDescription
languagestring

Language of the subtitle stream (e.g., "en").

codecstring

Codec used for the subtitle stream (e.g., "srt").

defaultboolean

Indicates if this is the default subtitle stream.

TableColumn

Table column configuration object used in Table components.

Type:
  • Object
Properties
NameTypeAttributesDefaultDescription
textstring

The text to be displayed in the column header. (Required when creating a new column)

typestring<optional>
"text"

Type of component to display/edit cell data. Possible values:

  • "text" - Plain text or HTML.
  • "password" - Masked password text field.
  • "textarea" - Multi-line text field.
  • "icon" - Image loaded from cell value source. Use table.onAction(callback) for click events.
  • "button" - String of button names separated by "|". Use table.onAction(callback) for click events.
  • "checkbox" - Boolean check mark selection component.
  • "combobox" - Drop-down list of values, can be editable.
  • "progress" - Progress bar showing integer value 0–100.
sortingTable.Sorting<optional>
Table.Sorting.Natural

Sorting mode. Table.Sorting.None disables sorting.

icon_sizenumber<optional>

For "icon" type, fixed width/height of the icon (largest dimension).

cache_capacitynumber<optional>
10

For "icon" type, number of images cached in RAM.

resizableboolean<optional>
true

Indicates if the column can be resized by the user.

auto_resizeboolean<optional>
true

Indicates if column auto-resizes with table (ignored if table auto resize is Table.AutoResize.None).

widthnumber<optional>

Initial desired width of the column.

min_widthnumber<optional>

Minimum width column can be resized to.

max_widthnumber<optional>

Maximum width column can be resized to.

hiddenboolean<optional>
false

Whether the column is hidden (width 0).

characterstring<optional>

Mask character for "password" type.

editableboolean<optional>
false

Whether text fields are editable.

clicksToEditboolean<optional>

Number of clicks required to make cell editable (only if editable).

optionsArray.<string><optional>

List of values for "combobox" type.

Example
<h2>Creating a simple column object:</h2>
let column = {
    text: "New Column",
    header_align: "center"
};

VideoDevice

Represents a video input device, such as WebCam, video capture device, etc. Used when getting input devices with videoInputDevices getter and when setting input device with setInputDevice() method.

Type:
  • Object
Properties
NameTypeAttributesDescription
namestring<optional>

Name of the video input device (only present when retrieving a list of video input devices).

idstring

ID of the video input device.

formatsArray.<VideoFormat><optional>

List of available video formats (only present when retrieving a list of video input devices).

formatVideoFormat<optional>

Chosen video format to use (required when setting a video input device).

Example
<h2>Setting a video input device:</h2>
const devices = player.videoInputDevices;
console.log(devices[0].formats[0]); // prints first format of a first device
const first_format = devices[0].formats[0];

// create new VideoDevice formatted object
const video_device = {
    id: devices[0].id,
    format: {
        size: first_format.size,
        fps: first_format.max_fps,
        pixel_format: first_format.pixel_format, // set pixel_format in case when it is used instead of vcodec
        vcodec: first_format.vcodec              // set vcodec in case when it is used instead of pixel format
    }
}

// set the video device and start playing
player.setInputDevice(video_device).play();

VideoFormat

Represents a video format for a VideoDevice. When using this VideoFormat for video input device, make sure that either "pixel_format" or "vcodec" is specified as it was set when you retrieved the supported formats.

Type:
  • Object
Properties
NameTypeAttributesDescription
sizestring

Video frame size in pixels (e.g., "1920x1080").

min_fpsnumber<optional>

Minimum available frame rate (e.g., 7.5). (provided when retrieving video input devices)

max_fpsnumber<optional>

Maximum available frame rate (e.g., 30). (provided when retrieving video input devices)

fpsnumber<optional>

Frame rate in frames per second (required when setting a video input device).

pixel_formatstring<optional>

Frame image pixel format coming out of the device (e.g., "yuyv422"). If this is present, then vcodec is absent.

vcodecstring<optional>

Encoded video format that the video device supports (e.g., "mjpeg", "h264"). If this is present, then pixel_format is absent.

Examples
<h2>Example of a VideoFormat object when retrieved with input devices:</h2>
const devices = player.videoInputDevices;
const first_format = devices[0].formats[0];
console.log(first_format); // prints first format of a first device

// outputs something like:
{
    size: "1920x1080",
    min_fps: 5,
    max_fps: 30,
    pixel_format: "yuyv422"
}
<h2>Setting a video input device:</h2>
const devices = player.videoInputDevices;
console.log(devices[0].formats[0]); // prints first format of a first device
const first_format = devices[0].formats[0];

// create new VideoDevice formatted object
const video_device = {
    id: devices[0].id,
    format: {
        size: first_format.size,
        fps: first_format.max_fps,
        pixel_format: first_format.pixel_format, // set pixel_format in case when it is used instead of vcodec
        vcodec: first_format.vcodec              // set vcodec in case when it is used instead of pixel format
    }
}

// set the video device and start playing
player.setInputDevice(video_device).play();

VideoStream

Describes a video stream in the media.

Type:
  • Object
Properties
NameTypeDescription
sampleWidthnumber

Original width of the video frame in pixels.

sampleHeightnumber

Original height of the video frame in pixels.

widthnumber

Display width of the video.

heightnumber

Display height of the video.

pixelAspectRatiostring

Pixel aspect ratio (e.g., "1:1").

displayAspectRatiostring

Display aspect ratio (e.g., "16:9").

frameRatenumber

Frame rate of the video stream.

codecstring

Codec used to encode the video stream (e.g., "h264").

pixelFormatstring

Pixel format of the video stream (e.g., "yuv420p").

progressiveboolean

Whether the video stream is progressive or interlaced.

defaultboolean

Indicates if this is the default video stream.