SwingUtilities

Methods
7
Fields
None

Methods

MethodReturnsDescription
isLeftMouseButton(AwtMouseEvent)booleanWhether anEvent is about the left button: it is held (InputEvent.BUTTON1_DOWN_MASK) or it is the button that changed (`MouseEvent.BUTTO…
isMiddleMouseButton(AwtMouseEvent)booleanWhether anEvent is about the middle button (BUTTON2_DOWN_MASK held, or MouseEvent.BUTTON2).
isRightMouseButton(AwtMouseEvent)booleanWhether anEvent is about the right button (BUTTON3_DOWN_MASK held, or MouseEvent.BUTTON3).
invokeLater(r: any)()During a Swing delivery, a follow-up that runs after the current event; anywhere else, the client thread's next invoke point. r (a functi…
invokeAndWait(r: any)()Runs r now (plugin code is always on the Swing thread here).
isEventDispatchThread()booleantrue: plugin code is always on the Swing thread here.
getWindowAncestor(c: any)anyThe first window above c (a JFrame or JDialog it is in; a window's owner); nil for a side panel's components (the sidebar is not a…

Method details

isLeftMouseButton

isLeftMouseButton: (AwtMouseEvent) -> boolean

Whether anEvent is about the left button: it is held (InputEvent.BUTTON1_DOWN_MASK) or it is the button that changed (MouseEvent.BUTTON1).

invokeLater

invokeLater: (r: any) -> ()

During a Swing delivery, a follow-up that runs after the current event; anywhere else, the client thread's next invoke point. r (a function, or a table with run) runs in a coroutine, so it may block on a dialog.

invokeAndWait

invokeAndWait: (r: any) -> ()

Runs r now (plugin code is always on the Swing thread here).

isEventDispatchThread

isEventDispatchThread: () -> boolean

true: plugin code is always on the Swing thread here.

getWindowAncestor

getWindowAncestor: (c: any) -> any

The first window above c (a JFrame or JDialog it is in; a window's owner); nil for a side panel's components (the sidebar is not a window), so frame:setLocationRelativeTo(SwingUtilities.getWindowAncestor(panel)) centres the frame. An ownerless JDialog answers nil.