java.awt

Class Frame

public class Frame extends Window implements MenuContainer

This class is a top-level window with a title bar and window decorations.
Nested Class Summary
protected classFrame.AccessibleAWTFrame
Accessibility support for Frame.
Field Summary
static intCROSSHAIR_CURSOR
Constant for a cross-hair cursor.
static intDEFAULT_CURSOR
Constant for the default cursor.
static intE_RESIZE_CURSOR
Cursor used over E edge of window decorations.
static intHAND_CURSOR
Constant for a hand cursor.
static intICONIFIED
static intMAXIMIZED_BOTH
static intMAXIMIZED_HORIZ
static intMAXIMIZED_VERT
static intMOVE_CURSOR
Constant for a cursor used during window move operations.
static intNE_RESIZE_CURSOR
Cursor used over NE corner of window decorations.
static intNORMAL
static intNW_RESIZE_CURSOR
Cursor used over NW corner of window decorations.
static intN_RESIZE_CURSOR
Cursor used over N edge of window decorations.
static intSE_RESIZE_CURSOR
Cursor used over SE corner of window decorations.
static intSW_RESIZE_CURSOR
Cursor used over SW corner of window decorations.
static intS_RESIZE_CURSOR
Cursor used over S edge of window decorations.
static intTEXT_CURSOR
Constant for a cursor over a text field.
static intWAIT_CURSOR
Constant for a cursor to display while waiting for an action to complete.
static intW_RESIZE_CURSOR
Cursor used over W edge of window decorations.
Constructor Summary
Frame()
Initializes a new instance of Frame that is not visible and has no title.
Frame(String title)
Initializes a new instance of Frame that is not visible and has the specified title.
Frame(GraphicsConfiguration gc)
Frame(String title, GraphicsConfiguration gc)
Method Summary
voidaddNotify()
AccessibleContextgetAccessibleContext()
Gets the AccessibleContext associated with this Frame.
intgetCursorType()
Returns the cursor type of the cursor for this window.
intgetExtendedState()
static Frame[]getFrames()
ImagegetIconImage()
Returns this frame's icon.
RectanglegetMaximizedBounds()
Returns the maximized bounds of this frame.
MenuBargetMenuBar()
Returns this frame's menu bar.
intgetState()
StringgetTitle()
Returns this frame's title string.
booleanisResizable()
Tests whether or not this frame is resizable.
booleanisUndecorated()
Returns whether this frame is undecorated or not.
protected StringparamString()
Returns a debugging string describing this window.
voidremove(MenuComponent menu)
Removes the specified menu component from this frame.
voidremoveNotify()
voidsetCursor(int type)
Sets the cursor for this window to the specified type.
voidsetExtendedState(int state)
voidsetIconImage(Image icon)
Sets this frame's icon to the specified value.
voidsetMaximizedBounds(Rectangle maximizedBounds)
voidsetMenuBar(MenuBar menuBar)
Sets this frame's menu bar.
voidsetResizable(boolean resizable)
Sets the resizability of this frame to the specified value.
voidsetState(int state)
voidsetTitle(String title)
Sets this frame's title to the specified value.
voidsetUndecorated(boolean undecorated)
Disables or enables decorations for this frame.

Field Detail

CROSSHAIR_CURSOR

public static final int CROSSHAIR_CURSOR

Deprecated: Use Cursor.CROSSHAIR_CURSOR instead.

Constant for a cross-hair cursor.

DEFAULT_CURSOR

public static final int DEFAULT_CURSOR

Deprecated: Replaced by Cursor.DEFAULT_CURSOR instead.

Constant for the default cursor.

E_RESIZE_CURSOR

public static final int E_RESIZE_CURSOR

Deprecated: Use Cursor.E_RESIZE_CURSOR instead.

Cursor used over E edge of window decorations.

HAND_CURSOR

public static final int HAND_CURSOR

Deprecated: Use Cursor.HAND_CURSOR instead.

Constant for a hand cursor.

ICONIFIED

public static final int ICONIFIED

MAXIMIZED_BOTH

public static final int MAXIMIZED_BOTH

MAXIMIZED_HORIZ

public static final int MAXIMIZED_HORIZ

MAXIMIZED_VERT

public static final int MAXIMIZED_VERT

MOVE_CURSOR

public static final int MOVE_CURSOR

Deprecated: Use Cursor.MOVE_CURSOR instead.

Constant for a cursor used during window move operations.

NE_RESIZE_CURSOR

public static final int NE_RESIZE_CURSOR

Deprecated: Use Cursor.NE_RESIZE_CURSOR instead.

Cursor used over NE corner of window decorations.

NORMAL

public static final int NORMAL

NW_RESIZE_CURSOR

public static final int NW_RESIZE_CURSOR

Deprecated: Use Cursor.NW_RESIZE_CURSOR instead.

Cursor used over NW corner of window decorations.

N_RESIZE_CURSOR

public static final int N_RESIZE_CURSOR

Deprecated: Use Cursor.N_RESIZE_CURSOR instead.

Cursor used over N edge of window decorations.

SE_RESIZE_CURSOR

public static final int SE_RESIZE_CURSOR

Deprecated: Use Cursor.SE_RESIZE_CURSOR instead.

Cursor used over SE corner of window decorations.

SW_RESIZE_CURSOR

public static final int SW_RESIZE_CURSOR

Deprecated: Use Cursor.SW_RESIZE_CURSOR instead.

Cursor used over SW corner of window decorations.

S_RESIZE_CURSOR

public static final int S_RESIZE_CURSOR

Deprecated: Use Cursor.S_RESIZE_CURSOR instead.

Cursor used over S edge of window decorations.

TEXT_CURSOR

public static final int TEXT_CURSOR

Deprecated: Use Cursor.TEXT_CURSOR instead.

Constant for a cursor over a text field.

WAIT_CURSOR

public static final int WAIT_CURSOR

Deprecated: Use Cursor.WAIT_CURSOR.

Constant for a cursor to display while waiting for an action to complete.

W_RESIZE_CURSOR

public static final int W_RESIZE_CURSOR

Deprecated: Use Cursor.W_RESIZE_CURSOR instead.

Cursor used over W edge of window decorations.

Constructor Detail

Frame

public Frame()
Initializes a new instance of Frame that is not visible and has no title.

Frame

public Frame(String title)
Initializes a new instance of Frame that is not visible and has the specified title.

Parameters: title the title of this frame

Frame

public Frame(GraphicsConfiguration gc)

Frame

public Frame(String title, GraphicsConfiguration gc)

Method Detail

addNotify

public void addNotify()

getAccessibleContext

public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this Frame. The context is created, if necessary.

Returns: the associated context

getCursorType

public int getCursorType()

Deprecated: Use Component.getCursor() instead.

Returns the cursor type of the cursor for this window. This will be one of the constants in this class.

Returns: the cursor type for this frame

getExtendedState

public int getExtendedState()

Since: 1.4

getFrames

public static Frame[] getFrames()

getIconImage

public Image getIconImage()
Returns this frame's icon.

Returns: this frame's icon, or null if this frame does not have an icon

getMaximizedBounds

public Rectangle getMaximizedBounds()
Returns the maximized bounds of this frame.

Returns: the maximized rectangle, may be null

Since: 1.4

getMenuBar

public MenuBar getMenuBar()
Returns this frame's menu bar.

Returns: this frame's menu bar, or null if this frame does not have a menu bar

getState

public int getState()

getTitle

public String getTitle()
Returns this frame's title string.

Returns: this frame's title string

isResizable

public boolean isResizable()
Tests whether or not this frame is resizable. This will be true by default.

Returns: true if this frame is resizable, false otherwise

isUndecorated

public boolean isUndecorated()
Returns whether this frame is undecorated or not.

Since: 1.4

paramString

protected String paramString()
Returns a debugging string describing this window.

Returns: a debugging string describing this window

remove

public void remove(MenuComponent menu)
Removes the specified menu component from this frame. If it is the current MenuBar it is removed from the frame. If it is a Popup it is removed from this component. If it is any other menu component it is ignored.

Parameters: menu the menu component to remove

removeNotify

public void removeNotify()

setCursor

public void setCursor(int type)

Deprecated: Use Component.setCursor(Cursor) instead.

Sets the cursor for this window to the specified type. The specified type should be one of the constants in this class.

Parameters: type the cursor type

setExtendedState

public void setExtendedState(int state)

Since: 1.4

setIconImage

public void setIconImage(Image icon)
Sets this frame's icon to the specified value.

UNKNOWN: the new icon for this frame

setMaximizedBounds

public void setMaximizedBounds(Rectangle maximizedBounds)

Since: 1.4

setMenuBar

public void setMenuBar(MenuBar menuBar)
Sets this frame's menu bar. Removes any existing menu bar. If the given menu bar is part of another frame it will be removed from that frame.

Parameters: menuBar the new menu bar for this frame

setResizable

public void setResizable(boolean resizable)
Sets the resizability of this frame to the specified value.

Parameters: resizable true to make the frame resizable, false to make it non-resizable

setState

public void setState(int state)

setTitle

public void setTitle(String title)
Sets this frame's title to the specified value.

Parameters: title the new frame title

setUndecorated

public void setUndecorated(boolean undecorated)
Disables or enables decorations for this frame. This method can only be called while the frame is not displayable.

Throws: IllegalComponentStateException if this frame is displayable

Since: 1.4