Advanced
Java
Services
|
Window |
Window dient hauptsächlich als Methodenlieferant für Frame und Dialog. Ein Window-Objekt ist lediglich
eine rechteckige Fläche auf dem Bildschirm, ohne Rand und nicht verschiebbar. Ein Window ist zwar ein
top-level-Container, aber es braucht, siehe Konstruktoren, ein
Frame oder ein Window, aus dem heraus es erzeugt wird.
Konstruktoren | |
Window(Frame owner) | Constructs a new invisible window with the specified Frame as its owner. |
Window(Window owner) | Constructs a new invisible window with the specified Window as its owner. |
Wichtige Methoden | |
Returntyp | Name der Methode |
Eventhandling | |
---|---|
void | addWindowListener(WindowListener l) Adds the specified WindowListener to receive WindowEvents from this frame. |
void | removeWindowListener(WindowListener l) Removes the specified WindowListener so that it no longer receives WindowEvents from this frame. |
void | addWindowFocusListener(WindowFocusListener l) Adds the specified window focus listener to receive window events from this window. |
void | removeWindowFocusListener(WindowFocusListener l) Removes the specified window focus listener so that it no longer receives window events from this window. |
void | addWindowStateListener(WindowStateListener l) Adds the specified window state listener to receive window events from this window |
void | removeWindowStateListener(WindowStateListener l) Removes the specified window state listener so that it no longer receives window events from this window. |
WindowFocusListener[] | getWindowFocusListeners() Returns an array of all the window focus listeners registered on this window. |
WindowListener[] | getWindowListeners() Returns an array of all the window listeners registered on this window. |
WindowStateListener[] | getWindowStateListeners() Returns an array of all the window state listeners registered on this window. |
Fokushandling | |
boolean | getFocusableWindowState() Returns whether this Window can become the focused Window if it meets the other requirements outlined in isFocusableWindow. |
Component | getFocusabgetFocusOwner() Returns the child Component of this Window that has focus if this Window is focused; returns null otherwise. |
Component | getMostRecentFocusOwner() Returns the child Component of this Window that will receive the focus when this Window is focused. |
boolean | isFocusableWindow() Returns whether this Window can become the focused Window, that is, whether this Window or any of its subcomponents can become the focus owner. |
boolean | isFocused() Returns whether this Window is focused. |
void | setFocusableWindowState(boolean focusableWindowState) Sets whether this Window can become the focused Window if it meets the other requirements outlined in isFocusableWindow. |
Zustand | |
void | hide() Hide this Window, its subcomponents, and all of its owned children. |
void | show() Makes the Window visible. |
void | toBack() If this Window is visible, sends this Window to the back and may cause it to lose focus or activation if it is the focused or active Window. |
void | toFront() If this Window is visible, brings this Window to the front and may make it the focused Window. |
void | pack() Causes this Window to be sized to fit the preferred size and layouts of its subcomponents. |
void | dispose() Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children. |