onUIChange([callback], remove)

Class: SwingUI.

Description:

Registers, unregisters and retrieves event handler for an event emitted when UI look and feel is changed using ui.ui(id) method.

Parameters:

Name Type Default Description

[callback]

function

Function to handle the event, null to remove all handlers, or omit to retrieve an array of handlers.

remove

boolean

false

Removed the callback from this event

Returns:

If called without parameters, an array of registered callbacks is returned; otherwise this instance of SwingUI class is returned.

Type: SwingUI | Array.<function()>

Examples:

Receive UI look and feel change events:

ui.onUIChange(e => {console.log(e);});

// when UI changes, it prints the event like this:
{
  newValue: {
    name: "Metal"
    dark: false
    id: "MetalLookAndFeel"
  }
  oldValue: {
    name: "FlatLaf Dark"
    dark: true
    id: "FlatDarkLaf"
  }
  event: "onUIChange"
  type: "change"
}

Also See: