moka.x
Class Frame

java.lang.Object
  extended bymoka.lang.Object
      extended bymoka.event.EventListener
          extended bymoka.x.Component
              extended bymoka.x.Container
                  extended bymoka.x.Frame
All Implemented Interfaces:
Captioned
Direct Known Subclasses:
OptionPane

public class Frame
extends Container
implements Captioned

Class Frame is a floating window.

Since:
MDK1.0a

Field Summary
 boolean closeButtonVisible
          Is the close button visible ? Should be only read.
 short defaultCloseOperation
          The default close operation for this frame.
static short DISPOSE_ON_CLOSE
          Indicate that the default close operation disposes of this frame.
static short DO_NOTHING_ON_CLOSE
          Indicate that the default close operation does nothing.
static short EXIT_ON_CLOSE
          Indicate that the default close operation exits the application.
static short HIDE_ON_CLOSE
          Indicate that the default close operation hides the frame.
 boolean minimizeButtonVisible
          Is the minimize button visible ? Should be only read.
 boolean modal
          Is this frame modal ? Should be only read.
 boolean movable
          Is this frame movable ?
 
Fields inherited from class moka.x.Container
child, tail
 
Fields inherited from class moka.x.Component
enabled, height, listen, mnemonic, next, parent, prev, visible, width, x, y
 
Fields inherited from interface moka.x.Captioned
caption, font
 
Constructor Summary
Frame()
           
Frame(java.lang.String caption)
           
 
Method Summary
 void dispose()
          Disposes of all ressources used by this frame and all its children.
 void finalize()
          Free the memory and system ressources used by this Frame.
 boolean isCursorOver(short x, short y)
          Indicates if the cursor is over this frame.
 boolean isCursorOverCloseButton(short x, short y)
          Indicates if the cursor is over the close button of this frame.
 boolean isCursorOverMinimizeButton(short x, short y)
          Indicates if the cursor is over the minimize button of this frame.
 boolean isCursorOverTitleBar(short x, short y)
          Indicates if the cursor is over the title bar of this frame.
 void onClose()
          Called when a CloseEvent occurs.
 void onDrag()
          Called when a DragEvent occurs.
 void onMinimize()
          Called when a MinimizeEvent occurs.
 void paint()
          Paints the frame.
 void paintForeground()
          Paints the foreground of the frame.
 void setCloseButtonVisible(boolean b)
          Sets the visibility of the close button.
 void setMinimizeButtonVisible(boolean b)
          Sets the visibility of the minimize button.
 void setModal(boolean b)
          Sets frame is modal or not.
 void setVisible(boolean b)
          Sets the visibility of the frame.
 void use()
          This method is invoked by the GEM when the user interacts with the frame.
 
Methods inherited from class moka.x.Container
add, checkMnemonic, clean, empty, onPaint, onRefresh, paintChildren, remove, repaintChildren, toFront
 
Methods inherited from class moka.x.Component
bottom, center, eventTriggered, left, move, right, setBounds, setEnabled, setHeight, setMnemonic, setWidth, setX, setY, top
 
Methods inherited from class moka.event.EventListener
eventTriggered
 
Methods inherited from class moka.lang.Object
equals, getClassName, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface moka.x.Captioned
setCaption, setFont
 

Field Detail

EXIT_ON_CLOSE

public static final short EXIT_ON_CLOSE
Indicate that the default close operation exits the application.

See Also:
Constant Field Values

DISPOSE_ON_CLOSE

public static final short DISPOSE_ON_CLOSE
Indicate that the default close operation disposes of this frame.

See Also:
Constant Field Values

HIDE_ON_CLOSE

public static final short HIDE_ON_CLOSE
Indicate that the default close operation hides the frame.

See Also:
Constant Field Values

DO_NOTHING_ON_CLOSE

public static final short DO_NOTHING_ON_CLOSE
Indicate that the default close operation does nothing.

See Also:
Constant Field Values

movable

public boolean movable
Is this frame movable ?


modal

public boolean modal
Is this frame modal ? Should be only read.


defaultCloseOperation

public short defaultCloseOperation
The default close operation for this frame.


closeButtonVisible

public boolean closeButtonVisible
Is the close button visible ? Should be only read.


minimizeButtonVisible

public boolean minimizeButtonVisible
Is the minimize button visible ? Should be only read.

Constructor Detail

Frame

public Frame()

Frame

public Frame(java.lang.String caption)
Method Detail

finalize

public void finalize()
Free the memory and system ressources used by this Frame.

Overrides:
finalize in class Component

use

public void use()
This method is invoked by the GEM when the user interacts with the frame.

Overrides:
use in class Container

isCursorOverCloseButton

public boolean isCursorOverCloseButton(short x,
                                       short y)
Indicates if the cursor is over the close button of this frame.

Parameters:
x - the reference's horizontal coordinate
y - the reference's vertical coordinate
Returns:
true if the cursor is over the close button, false otherwize.

isCursorOverMinimizeButton

public boolean isCursorOverMinimizeButton(short x,
                                          short y)
Indicates if the cursor is over the minimize button of this frame.

Parameters:
x - the reference's horizontal coordinate
y - the reference's vertical coordinate
Returns:
true if the cursor is over the minimize button, false otherwize.

isCursorOverTitleBar

public boolean isCursorOverTitleBar(short x,
                                    short y)
Indicates if the cursor is over the title bar of this frame.

Parameters:
x - the reference's horizontal coordinate
y - the reference's vertical coordinate
Returns:
true if the cursor is over the title bar, false otherwize.

onClose

public void onClose()
Called when a CloseEvent occurs. The method will perform a task according to the default close operation of this frame. A CloseEvent occurs when the user uses the close button of the frame.


onMinimize

public void onMinimize()
Called when a MinimizeEvent occurs. The method will minimize the window to the task bar of the desktop. A MinimizeEvent occurs when the user uses the minimize button of the frame.


onDrag

public void onDrag()
Called when a DragEvent occurs. The method will notify the GEM with a DragEvent. A DragEvent occurs when the user click on the title bar.


dispose

public void dispose()
Disposes of all ressources used by this frame and all its children.


setVisible

public void setVisible(boolean b)
Sets the visibility of the frame.

Overrides:
setVisible in class Component
Parameters:
b - true if the frame should be visible, false otherwize.

setModal

public void setModal(boolean b)
Sets frame is modal or not.

Parameters:
b - true if the frame should be modal, false otherwize.

setCloseButtonVisible

public void setCloseButtonVisible(boolean b)
Sets the visibility of the close button.

Parameters:
b - true if the close button should be visible, false otherwize.

setMinimizeButtonVisible

public void setMinimizeButtonVisible(boolean b)
Sets the visibility of the minimize button.

Parameters:
b - true if the minimize button should be visible, false otherwize.

paint

public void paint()
Paints the frame.

Overrides:
paint in class Component

paintForeground

public void paintForeground()
Paints the foreground of the frame.

Overrides:
paintForeground in class Container

isCursorOver

public boolean isCursorOver(short x,
                            short y)
Indicates if the cursor is over this frame.

Overrides:
isCursorOver in class Component
Parameters:
x - the reference's horizontal coordinate
y - the reference's vertical coordinate
Returns:
true if the cursor is over the frame, false otherwize.