Thursday 14 May 2015

Windows in Java

  The Window class implements a window with no borders and no menu bar. This generally isn't a useful class on its own, but because Frame and Dialog-which are useful-extend it, it's useful to take a quick look at Window's methods.
dispose()
This gets rid of the window's peer. When the window is destroyed, you need to call this method. This is a synchronized method.
Toolkit, getToolkit()
Returns the Toolkit associated with the window.
show()
Displays the window, making it visible and moving it to the front. This is a synchronized method.
toBack()
Moves the window behind all other windows in the application.
toFront()
Moves the window in front of all other windows.
User interactions with a window can cause it to generate the WINDOW_DESTROY, WINDOW_ICONIFY, WINDOW_DEICONIFY, and WINDOW_MOVED events.


Note
Here's another example of how the AWT conforms to the expectations of platform users. On the Mac, the window doesn't reduce to an icon, because that is not the sort of behavior a Mac user would expect.

No comments:

Post a Comment