java.awt
Class Frame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
All Implemented Interfaces:
java.awt.image.ImageObserver, MenuContainer

public class Frame
extends Window
implements MenuContainer

A Frame is a top-level window with a title. The default layout for a frame is BorderLayout.


Field Summary
static int CROSSHAIR_CURSOR
           
static int DEFAULT_CURSOR
           
static int E_RESIZE_CURSOR
           
static int HAND_CURSOR
           
static int MOVE_CURSOR
           
static int N_RESIZE_CURSOR
           
static int NE_RESIZE_CURSOR
           
static int NW_RESIZE_CURSOR
           
static int S_RESIZE_CURSOR
           
static int SE_RESIZE_CURSOR
           
static int SW_RESIZE_CURSOR
           
static int TEXT_CURSOR
           
static int W_RESIZE_CURSOR
           
static int WAIT_CURSOR
           
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Frame()
          Constructs a new Frame that is initially invisible.
Frame(String title)
          Constructs a new, initially invisible Frame with the specified title.
 
Method Summary
 void addNotify()
          Creates the Frame's peer.
 void dispose()
          Disposes of the Frame.
 int getCursorType()
          Return the cursor type
 Image getIconImage()
          Returns the icon image for this Frame.
 MenuBar getMenuBar()
          Gets the menu bar for this Frame.
 String getTitle()
          Gets the title of the Frame.
 boolean isResizable()
          Returns true if the user can resize the Frame.
protected  String paramString()
          Returns the parameter String of this Frame.
 void remove(MenuComponent m)
          Removes the specified menu bar from this Frame.
 void setCursor(int cursorType)
          Set the cursor image to a predefined cursor.
 void setIconImage(Image image)
          Sets the image to display when this Frame is iconized.
 void setMenuBar(MenuBar mb)
          Sets the menubar for this Frame to the specified menubar.
 void setResizable(boolean resizable)
          Sets the resizable flag.
 void setTitle(String title)
          Sets the title for this Frame to the specified title.
 
Methods inherited from class java.awt.Window
getToolkit, getWarningString, pack, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, countComponents, deliverEvent, getComponent, getComponents, getLayout, insets, layout, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, removeAll, removeNotify, setLayout, validate
 
Methods inherited from class java.awt.Component
action, bounds, checkImage, checkImage, createImage, createImage, disable, enable, enable, getBackground, getColorModel, getFont, getFontMetrics, getForeground, getGraphics, getParent, getPeer, gotFocus, handleEvent, hide, imageUpdate, inside, invalidate, isEnabled, isShowing, isValid, isVisible, keyDown, keyUp, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, prepareImage, prepareImage, print, printAll, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setFont, setForeground, show, size, toString, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

DEFAULT_CURSOR

public static final int DEFAULT_CURSOR
See Also:
Constant Field Values

CROSSHAIR_CURSOR

public static final int CROSSHAIR_CURSOR
See Also:
Constant Field Values

TEXT_CURSOR

public static final int TEXT_CURSOR
See Also:
Constant Field Values

WAIT_CURSOR

public static final int WAIT_CURSOR
See Also:
Constant Field Values

SW_RESIZE_CURSOR

public static final int SW_RESIZE_CURSOR
See Also:
Constant Field Values

SE_RESIZE_CURSOR

public static final int SE_RESIZE_CURSOR
See Also:
Constant Field Values

NW_RESIZE_CURSOR

public static final int NW_RESIZE_CURSOR
See Also:
Constant Field Values

NE_RESIZE_CURSOR

public static final int NE_RESIZE_CURSOR
See Also:
Constant Field Values

N_RESIZE_CURSOR

public static final int N_RESIZE_CURSOR
See Also:
Constant Field Values

S_RESIZE_CURSOR

public static final int S_RESIZE_CURSOR
See Also:
Constant Field Values

W_RESIZE_CURSOR

public static final int W_RESIZE_CURSOR
See Also:
Constant Field Values

E_RESIZE_CURSOR

public static final int E_RESIZE_CURSOR
See Also:
Constant Field Values

HAND_CURSOR

public static final int HAND_CURSOR
See Also:
Constant Field Values

MOVE_CURSOR

public static final int MOVE_CURSOR
See Also:
Constant Field Values
Constructor Detail

Frame

public Frame()
Constructs a new Frame that is initially invisible.

See Also:
Component.resize(int, int), Component.show()

Frame

public Frame(String title)
Constructs a new, initially invisible Frame with the specified title.

Parameters:
title - te specified title
See Also:
Component.resize(int, int), Component.show()
Method Detail

addNotify

public void addNotify()
Creates the Frame's peer. The peer allows us to change the look of the Frame without changing its functionality.

Overrides:
addNotify in class Window
See Also:
Container.removeNotify()

getTitle

public String getTitle()
Gets the title of the Frame.

See Also:
setTitle(java.lang.String)

setTitle

public void setTitle(String title)
Sets the title for this Frame to the specified title.

Parameters:
title - the specified title of this Frame
See Also:
getTitle()

getIconImage

public Image getIconImage()
Returns the icon image for this Frame.


setIconImage

public void setIconImage(Image image)
Sets the image to display when this Frame is iconized. Note that not all platforms support the concept of iconizing a window.

Parameters:
image - the icon image to be displayed

getMenuBar

public MenuBar getMenuBar()
Gets the menu bar for this Frame.


setMenuBar

public void setMenuBar(MenuBar mb)
Sets the menubar for this Frame to the specified menubar.

Parameters:
mb - the menubar being set

remove

public void remove(MenuComponent m)
Removes the specified menu bar from this Frame.

Specified by:
remove in interface MenuContainer

dispose

public void dispose()
Disposes of the Frame. This method must be called to release the resources that are used for the frame.

Overrides:
dispose in class Window

isResizable

public boolean isResizable()
Returns true if the user can resize the Frame.


setResizable

public void setResizable(boolean resizable)
Sets the resizable flag.

Parameters:
resizable - true if resizable; false otherwise.

setCursor

public void setCursor(int cursorType)
Set the cursor image to a predefined cursor.

Parameters:
cursorType - one of the cursor constants defined above.

getCursorType

public int getCursorType()
Return the cursor type


paramString

protected String paramString()
Returns the parameter String of this Frame.

Overrides:
paramString in class Container