|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjewl.Window
The abstract base class for all other JEWL window classes. Apart from top-level windows (frames and dialogs), every window is contained inside another window. The origin of the top-left corner of a window enclosed in another window (the parent window) is expressed by an (x,y) coordinate (two integers giving the distance in pixels across, and then down, from the top-left corner of the parent window). Negative values for the coordinates allow these offsets to be measured from the bottom or right edges of the parent window rather than the top and left; for example, an origin of (-20,5) means an origin located 20 pixels in from the right-hand edge of the parent window and 5 pixels down from the top edge.
Heights and widths can also be specified relative to the size of the
parent window. Positive values are used for absolute heights and widths,
whereas zero or negative values are taken to be relative to the height
or width of the parent window. Zero means the same height or width as
the parent window, and a negative value -n means n pixels
less than the corresponding dimension of the parent window.
Coordinates which are relative to the parent window are adjusted if the size of the parent window changes. For example, a window with an origin of (5,-50) and a width of -10 will be adjusted so that if the size of the parent window is changed, the enclosed window will be adjusted so that its top-left corner is still positioned 5 pixels from the left of the parent window's left edge, 50 pixels up from the parent window's bottom edge, and the width will be 10 pixels less than the width of the parent window.
Methods inherited from Window allow you to show or hide a window,
test whether it is visible on the screen, get or set its size or position,
and get or set the font it uses.
| Method Summary | |
void |
addEventListener(EventListener listener)
Add an event listener associated with this window. |
static boolean |
commandAvailable()
Test if a new command code is available. |
static char |
getCommand()
Get the most recently generated command code. |
Font |
getFont()
Get the current font used in this window. |
int |
getHeight()
Get the current height of this window. |
int |
getID()
Get the ID number for this window. |
int |
getLeft()
Get the coordinate of the left edge of this window relative to the left of its parent window. |
static int |
getScreenHeight()
Get the height of the entire screen. |
static int |
getScreenWidth()
Get the width of the entire screen. |
static Window |
getSource()
Get a reference to the window which generated the most recent command. |
int |
getTop()
Get the coordinate of the top edge of this window relative to the top of its parent window. |
int |
getWidth()
Get the current width of this window. |
void |
hide()
Hide this window. |
static void |
init()
Register the calling thread as a user interface thread. |
boolean |
isVisible()
Test if this window is visible. |
static char |
nextCommand()
Wait for a command code to be generated by any window. |
Container |
parent()
Get the parent window enclosing this one. |
Container |
root()
Get the top-level window enclosing this one. |
void |
setFont(java.awt.Font font)
Set the font to be used for any text in this window. |
void |
setID(int id)
Set the ID number for this window. |
void |
setLocation(int left,
int top)
Set the location of this window within the parent window. |
void |
setSize(int width,
int height)
Set the size of this window. |
void |
show()
Show this window. |
void |
show(boolean visible)
Show or hide this window. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static void init()
public void addEventListener(EventListener listener)
listener - an event listener.which implements the EventListener
interface.public void setID(int id)
id - the desired ID number.public int getID()
setID(int)public void show(boolean visible)
visible - true if this window should be made visible, false if it should
be hidden.public void show()
show(true).
show(boolean)public void hide()
show(false).
show(boolean)public boolean isVisible()
public void setSize(int width,
int height)
width - the desired width in pixels.height - the desired height in pixels.
public void setLocation(int left,
int top)
left - the desired position of the left edge of this window relative to
the left edge of the parent window, or to the right edge if the
value given is negative, measured in pixels.top - the desired position of the top edge of this window relative to
the top edge of the parent window, or to the bottom edge if the
value given is negative, measured in pixels.public int getTop()
public int getLeft()
public int getWidth()
public int getHeight()
public static int getScreenWidth()
public static int getScreenHeight()
public void setFont(java.awt.Font font)
font - the desired font to be applied. If this is null, the parent
window's font will be used. Although this is specified as a
java.awt.Font, you can use jewl.Font instead.Fontpublic Font getFont()
public Container parent()
public Container root()
public static char nextCommand()
java.lang.IllegalStateException - if no windows are visible when the method is calledpublic static Window getSource()
Window.getSource().root()
if (Window.getSource().root() == myFrame) {
...
}
root()public static char getCommand()
public static boolean commandAvailable()
nextCommand()
was called.
nextCommand().nextCommand()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||