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 IonActivated(sprouts.Action<WindowDelegate<W, WindowEvent>> onActivate) Adds the suppliedActionwrapped in aWindowListenerto the component, to receiveWindowListener.windowActivated(WindowEvent)events which are invoked when the Window is set to be the active Window.final IonClose(sprouts.Action<WindowDelegate<W, WindowEvent>> onClose) Adds the suppliedActionwrapped in aWindowListenerto the component, to receiveWindowListener.windowClosing(WindowEvent)events which are invoked when a window is in the process of being closed.final IonClosed(sprouts.Action<WindowDelegate<W, WindowEvent>> onClose) Adds the suppliedActionwrapped in aWindowListenerto the component, to receiveWindowListener.windowClosed(WindowEvent)events which are invoked when a window has been closed.final IonDeactivated(sprouts.Action<WindowDelegate<W, WindowEvent>> onDeactivate) Adds the suppliedActionwrapped in aWindowListenerto the component, to receiveWindowListener.windowDeactivated(WindowEvent)events which are invoked when a Window is no longer the active Window.final IonDeiconified(sprouts.Action<WindowDelegate<W, WindowEvent>> onDeiconify) Adds the suppliedActionwrapped in aWindowListenerto 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 IonFocusGain(sprouts.Action<WindowDelegate<W, FocusEvent>> onFocus) Adds the suppliedActionwrapped in aFocusListenerto the component, to receive those focus events where the wrapped component gains input focus.final IonFocusLoss(sprouts.Action<WindowDelegate<W, FocusEvent>> onFocus) Adds the suppliedActionwrapped in a focus listener to receive those focus events where the wrapped component loses input focus.final IonIconified(sprouts.Action<WindowDelegate<W, WindowEvent>> onIconify) Adds the suppliedActionwrapped in aWindowListenerto the component, to receiveWindowListener.windowIconified(WindowEvent)events which are invoked when a window is changed from a normal to a minimized state.final IonInputFocusGained(sprouts.Action<WindowDelegate<W, WindowEvent>> onFocusGained) Adds the suppliedActionwrapped in aWindowListenerto 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 IonInputFocusLost(sprouts.Action<WindowDelegate<W, WindowEvent>> onFocusLost) Adds the suppliedActionwrapped in aWindowListenerto 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 IonOpened(sprouts.Action<WindowDelegate<W, WindowEvent>> onOpen) Adds the suppliedActionwrapped in aWindowListenerto the component, to receiveWindowListener.windowOpened(WindowEvent)events which are invoked when a window has been opened.final IonPressed(Keyboard.Key key, sprouts.Action<WindowDelegate<W, ActionEvent>> onKeyPressed) Adds the suppliedActionwrapped in aKeyListenerto the component, to receive key events triggered when the wrapped component receives a particular keyboard input matching the providedKeyboard.Key.final IonStateChanged(sprouts.Action<WindowDelegate<W, WindowEvent>> onStateChanged) Adds the suppliedActionwrapped in aWindowListenerto the component, to receiveWindowStateListener.windowStateChanged(WindowEvent)events which are invoked when a window has been changed.abstract voidshow()Makes the window visible in the center of the screen.final IwithOnCloseOperation(UI.OnWindowClose onClose) Sets theUI.OnWindowCloseoperation for the window.final IAdds a title to the window.final IBinds 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, _onShowDelegated, _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.OnWindowCloseoperation 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 suppliedActionwrapped in aKeyListenerto the component, to receive key events triggered when the wrapped component receives a particular keyboard input matching the providedKeyboard.Key.- Parameters:
key- TheKeyboard.Keywhich should be matched to the key event.onKeyPressed- TheActionwhich 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 suppliedActionwrapped in aFocusListenerto the component, to receive those focus events where the wrapped component gains input focus.- Parameters:
onFocus- TheActionwhich 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 suppliedActionwrapped in a focus listener to receive those focus events where the wrapped component loses input focus.- Parameters:
onFocus- TheActionwhich 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 suppliedActionwrapped in aWindowListenerto 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- TheActionwhich 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 suppliedActionwrapped in aWindowListenerto 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- TheActionwhich should be invoked when the wrapped component has been closed.- Returns:
- This very instance, which enables builder-style method chaining.
-
onOpened
Adds the suppliedActionwrapped in aWindowListenerto 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- TheActionwhich should be invoked when the wrapped component has been opened.- Returns:
- This very instance, which enables builder-style method chaining.
-
onIconified
Adds the suppliedActionwrapped in aWindowListenerto 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- TheActionwhich should be invoked when the wrapped component has been iconified.- Returns:
- This very instance, which enables builder-style method chaining.
-
onDeiconified
Adds the suppliedActionwrapped in aWindowListenerto 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- TheActionwhich should be invoked when the wrapped component has been deiconified.- Returns:
- This very instance, which enables builder-style method chaining.
-
onActivated
Adds the suppliedActionwrapped in aWindowListenerto 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- TheActionwhich should be invoked when the wrapped component has been activated.- Returns:
- This very instance, which enables builder-style method chaining.
-
onDeactivated
Adds the suppliedActionwrapped in aWindowListenerto 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- TheActionwhich should be invoked when the wrapped component has been deactivated.- Returns:
- This very instance, which enables builder-style method chaining.
-
onStateChanged
Adds the suppliedActionwrapped in aWindowListenerto 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- TheActionwhich should be invoked when the wrapped component has been changed.- Returns:
- This very instance, which enables builder-style method chaining.
-
onInputFocusGained
Adds the suppliedActionwrapped in aWindowListenerto 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- TheActionwhich should be invoked when the wrapped component has gained input focus.- Returns:
- This very instance, which enables builder-style method chaining.
-
onInputFocusLost
Adds the suppliedActionwrapped in aWindowListenerto 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- TheActionwhich should be invoked when the wrapped component has lost input focus.- Returns:
- This very instance, which enables builder-style method chaining.
-