java.lang.Object
swingtree.UIForAnything<I,W,Component>
swingtree.UIForAnyWindow<I,W>
- Type Parameters:
I
- The type of the builder itself.W
- The type of the window which is being configured by this builder.
- Direct Known Subclasses:
UIForJDialog
,UIForJFrame
public abstract class UIForAnyWindow<I extends UIForAnyWindow<I,W>,W extends Window>
extends UIForAnything<I,W,Component>
A SwingTree builder node for configuring any kind of
Window
type.
Take a look at the UIForJDialog
and UIForJFrame
classes,
which are specialized subtypes of this class.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription_getRootPaneOf
(W thisWindow) protected abstract void
_setTitleOf
(W thisWindow, String title) final I
onActivated
(sprouts.Action<WindowDelegate<W, WindowEvent>> onActivate) Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowActivated(WindowEvent)
events which are invoked when the Window is set to be the active Window.final I
onClose
(sprouts.Action<WindowDelegate<W, WindowEvent>> onClose) Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowClosing(WindowEvent)
events which are invoked when a window is in the process of being closed.final I
onClosed
(sprouts.Action<WindowDelegate<W, WindowEvent>> onClose) Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowClosed(WindowEvent)
events which are invoked when a window has been closed.final I
onDeactivated
(sprouts.Action<WindowDelegate<W, WindowEvent>> onDeactivate) Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowDeactivated(WindowEvent)
events which are invoked when a Window is no longer the active Window.final I
onDeiconified
(sprouts.Action<WindowDelegate<W, WindowEvent>> onDeiconify) Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowDeiconified(WindowEvent)
events which are invoked when a window is changed from a minimized to a normal state, usually by the user restoring it from the task bar.final I
onFocusGain
(sprouts.Action<WindowDelegate<W, FocusEvent>> onFocus) Adds the suppliedAction
wrapped in aFocusListener
to the component, to receive those focus events where the wrapped component gains input focus.final I
onFocusLoss
(sprouts.Action<WindowDelegate<W, FocusEvent>> onFocus) Adds the suppliedAction
wrapped in a focus listener to receive those focus events where the wrapped component loses input focus.final I
onIconified
(sprouts.Action<WindowDelegate<W, WindowEvent>> onIconify) Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowIconified(WindowEvent)
events which are invoked when a window is changed from a normal to a minimized state.final I
onInputFocusGained
(sprouts.Action<WindowDelegate<W, WindowEvent>> onFocusGained) Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowFocusListener.windowGainedFocus(WindowEvent)
events which are invoked when the window is set to be gaining input focus, which means that the Window, or one of its subcomponents, will receive keyboard events.final I
onInputFocusLost
(sprouts.Action<WindowDelegate<W, WindowEvent>> onFocusLost) Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowFocusListener.windowLostFocus(WindowEvent)
events which are invoked when the window is set to be losing input focus, which means that input focus is being transferred to another Window or no Window at all and that keyboard events will no longer be delivered to the Window or any of its subcomponents.final I
onOpened
(sprouts.Action<WindowDelegate<W, WindowEvent>> onOpen) Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowOpened(WindowEvent)
events which are invoked when a window has been opened.final I
onPressed
(Keyboard.Key key, sprouts.Action<WindowDelegate<W, ActionEvent>> onKeyPressed) Adds the suppliedAction
wrapped in aKeyListener
to the component, to receive key events triggered when the wrapped component receives a particular keyboard input matching the providedKeyboard.Key
.final I
onStateChanged
(sprouts.Action<WindowDelegate<W, WindowEvent>> onStateChanged) Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowStateListener.windowStateChanged(WindowEvent)
events which are invoked when a window has been changed.abstract void
show()
Makes the window visible in the center of the screen.final I
withOnCloseOperation
(UI.OnWindowClose onClose) Sets theUI.OnWindowClose
operation for the window.final I
Adds a title to the window.final I
Binds a text property to the window determining the title displayed in the top bar of the window.Methods inherited from class swingtree.UIForAnything
_addBuildersTo, _addBuilderTo, _addComponentsTo, _addComponentTo, _disposeState, _newBuilderWithState, _onShow, _onShow, _runInApp, _runInApp, _runInUI, _state, _this, _with, _withOnShow, _withOnShow, add, add, add, add, apply, applyIf, applyIfPresent, component, equals, get, getComponent, getType, hashCode, peek, toString
-
Constructor Details
-
UIForAnyWindow
public UIForAnyWindow()
-
-
Method Details
-
withTitle
Adds a title to the window.
Note that the way this is displayed depends on the window type and the operating system.- Parameters:
title
- The title to be shown in the top bar of the window.- Returns:
- This builder.
-
withTitle
Binds a text property to the window determining the title displayed in the top bar of the window.
Note that the way this is displayed depends on the window type and the operating system.- Parameters:
title
- The title property whose text will be shown in the top bar of the window.- Returns:
- This builder.
-
withOnCloseOperation
Sets theUI.OnWindowClose
operation for the window.
This translates toJFrame.setDefaultCloseOperation(int)
orJDialog.setDefaultCloseOperation(int)
depending on the window type. The following operations are supported:UI.OnWindowClose.DO_NOTHING
- Do nothing when the window is closed.UI.OnWindowClose.HIDE
- Hide the window when it is closed.UI.OnWindowClose.DISPOSE
- Dispose the window when it is closed.
- Parameters:
onClose
- The operation to be executed when the window is closed.- Returns:
- This declarative builder instance to enable method chaining.
-
show
public abstract void show()Makes the window visible in the center of the screen. -
_getRootPaneOf
-
_setTitleOf
-
onPressed
public final I onPressed(Keyboard.Key key, sprouts.Action<WindowDelegate<W, ActionEvent>> onKeyPressed) Adds the suppliedAction
wrapped in aKeyListener
to the component, to receive key events triggered when the wrapped component receives a particular keyboard input matching the providedKeyboard.Key
.- Parameters:
key
- TheKeyboard.Key
which should be matched to the key event.onKeyPressed
- TheAction
which will be executed once the wrapped component received the targeted key press.- Returns:
- This very instance, which enables builder-style method chaining.
-
onFocusGain
Adds the suppliedAction
wrapped in aFocusListener
to the component, to receive those focus events where the wrapped component gains input focus.- Parameters:
onFocus
- TheAction
which should be executed once the input focus was gained on the wrapped component.- Returns:
- This very instance, which enables builder-style method chaining.
-
onFocusLoss
Adds the suppliedAction
wrapped in a focus listener to receive those focus events where the wrapped component loses input focus.- Parameters:
onFocus
- TheAction
which should be executed once the input focus was lost on the wrapped component.- Returns:
- This very instance, which enables builder-style method chaining.
-
onClose
Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowClosing(WindowEvent)
events which are invoked when a window is in the process of being closed. The close operation can be overridden at this point (seeWindowConstants.DO_NOTHING_ON_CLOSE
).
Note that this kind of event is typically triggered when the user clicks the close button in the top bar of the window.- Parameters:
onClose
- TheAction
which should be invoked when the wrapped component is in the process of being closed.- Returns:
- This very instance, which enables builder-style method chaining.
-
onClosed
Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowClosed(WindowEvent)
events which are invoked when a window has been closed.
Note that this kind of event is typically triggered when the user clicks the close button in the top bar of the window.- Parameters:
onClose
- TheAction
which should be invoked when the wrapped component has been closed.- Returns:
- This very instance, which enables builder-style method chaining.
-
onOpened
Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowOpened(WindowEvent)
events which are invoked when a window has been opened.
Note that this kind of event is typically triggered when the user clicks the close button in the top bar of the window.- Parameters:
onOpen
- TheAction
which should be invoked when the wrapped component has been opened.- Returns:
- This very instance, which enables builder-style method chaining.
-
onIconified
Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowIconified(WindowEvent)
events which are invoked when a window is changed from a normal to a minimized state. For many platforms, a minimized window is displayed as the icon specified in the window's iconImage property.
Minification is usually triggered when the user clicks the minimize button in the top bar of the window. But this depends on the operating system.- Parameters:
onIconify
- TheAction
which should be invoked when the wrapped component has been iconified.- Returns:
- This very instance, which enables builder-style method chaining.
-
onDeiconified
Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowDeiconified(WindowEvent)
events which are invoked when a window is changed from a minimized to a normal state, usually by the user restoring it from the task bar.- Parameters:
onDeiconify
- TheAction
which should be invoked when the wrapped component has been deiconified.- Returns:
- This very instance, which enables builder-style method chaining.
-
onActivated
Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowActivated(WindowEvent)
events which are invoked when the Window is set to be the active Window. Only a Frame or a Dialog can be the active Window. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window. So this kind of event is usually triggered when the user makes the window active by clicking it.- Parameters:
onActivate
- TheAction
which should be invoked when the wrapped component has been activated.- Returns:
- This very instance, which enables builder-style method chaining.
-
onDeactivated
Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowListener.windowDeactivated(WindowEvent)
events which are invoked when a Window is no longer the active Window. Only a Frame or a Dialog can be the active Window. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window. This kind of event typically occurs when the user clicks another window in the task bar of the operating system.- Parameters:
onDeactivate
- TheAction
which should be invoked when the wrapped component has been deactivated.- Returns:
- This very instance, which enables builder-style method chaining.
-
onStateChanged
Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowStateListener.windowStateChanged(WindowEvent)
events which are invoked when a window has been changed.
Note that this kind of event is typically invoked when the window is iconified, minimized, maximized or restored.- Parameters:
onStateChanged
- TheAction
which should be invoked when the wrapped component has been changed.- Returns:
- This very instance, which enables builder-style method chaining.
-
onInputFocusGained
Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowFocusListener.windowGainedFocus(WindowEvent)
events which are invoked when the window is set to be gaining input focus, which means that the Window, or one of its subcomponents, will receive keyboard events. This event is typically triggered when the user clicks the window.- Parameters:
onFocusGained
- TheAction
which should be invoked when the wrapped component has gained input focus.- Returns:
- This very instance, which enables builder-style method chaining.
-
onInputFocusLost
Adds the suppliedAction
wrapped in aWindowListener
to the component, to receiveWindowFocusListener.windowLostFocus(WindowEvent)
events which are invoked when the window is set to be losing input focus, which means that input focus is being transferred to another Window or no Window at all and that keyboard events will no longer be delivered to the Window or any of its subcomponents.- Parameters:
onFocusLost
- TheAction
which should be invoked when the wrapped component has lost input focus.- Returns:
- This very instance, which enables builder-style method chaining.
-