Package java.awt |
![]() Previous |
![]() Java API |
![]() Index |
![]() Next |
public class java.awt.Frame extends java.awt.Window implements java.awt.MenuContainer { // possible cursor types for the setCursor method public final static int CROSSHAIR_CURSOR; public final static int DEFAULT_CURSOR; public final static int E_RESIZE_CURSOR; public final static int HAND_CURSOR; public final static int MOVE_CURSOR; public final static int N_RESIZE_CURSOR; public final static int NE_RESIZE_CURSOR; public final static int NW_RESIZE_CURSOR; public final static int S_RESIZE_CURSOR; public final static int SE_RESIZE_CURSOR; public final static int SW_RESIZE_CURSOR; public final static int TEXT_CURSOR; public final static int W_RESIZE_CURSOR; public final static int WAIT_CURSOR; // Constructors public Frame(); public Frame(String title); // Methods public void addNotify(); public void dispose(); public int getCursorType(); public Image getIconImage(); public MenuBar getMenuBar(); public String getTitle(); public boolean isResizable(); protected String paramString(); public void remove(MenuComponent m); public void setCursor(int cursorType); public void setIconImage(Image image); public void setMenuBar(MenuBar mb); public void setResizable(boolean resizable); public void setTitle(String title); }
A frame is a top-level window with a title and a border. A frame can also have a menu bar. The AWT sends the frame all mouse, keyboard, and focus events that occur over it.
public final static int CROSSHAIR_CURSOR = 1A cross-haired shaped cursor.
public final static int DEFAULT_CURSOR = 0The default cursor.
public final static int E_RESIZE_CURSOR = 11A cursor indicating that the right-hand border is being resized.
public final static int HAND_CURSOR = 12A hand-shaped cursor.
public final static int MOVE_CURSOR = 13A cursor indicating that an object is being moved.
public final static int N_RESIZE_CURSOR = 8A cursor indicating that the top border is being resized.
public final static int NE_RESIZE_CURSOR = 7A cursor indicating that the top-right corner is being resized.
public final static int NW_RESIZE_CURSOR = 6A cursor indicating the the top-left corner is being resized.
public final static int S_RESIZE_CURSOR = 9A cursor indicating the the bottom edge is being resized.
public final static int SE_RESIZE_CURSOR = 5A cursor indicating that the bottom-right edge is being resized.
public final static int SW_RESIZE_CURSOR = 4A cursor indicating that the bottom-left edge is being resized.
public final static int TEXT_CURSOR = 2A cursor for text insertion.
public final static int W_RESIZE_CURSOR = 10A cursor indicating the the left edge is being resized.
public final static int WAIT_CURSOR = 3A cursor indicating that a long-running operation is taking place
public Frame()Constructs a new frame; it is initially invisible and has no title.
public Frame(String title)Constructs a new frame; it is initially invisible and has the specified title.
Parameter Description title the title
public void addNotify()This method calls the createFrame method of this object's toolkit in order to create a FramePeer for this frame. This peer allows the application to change the look of a frame without changing its functionality.
Most applications do not call this method directly.
Overrides:
addNotify in class Window .
public void dispose()Disposes of this frame, its menubar, and any system resources used by this frame.
Overrides:
dispose in class Window .
public int getCursorType()Return Value:
Returns the cursor type of this frame.
public Image getIconImage()Return Value:
Returns the icon image for this frame, or null if this frame doesn't have an icon image.
public MenuBar getMenuBar()Return Value:
Returns the menu bar for this frame, or null if this frame doesn't have a menu bar.
public String getTitle()Return Value:
Returns the title of this frame, or null if this frame doesn't have a title
See Also: setTitle .
public boolean isResizable()Indicates whether this frame is resizable. By default, all frames are resizable.
Return Value:
Returns true if the user can resize this frame; false otherwise.
protected String paramString()Returns the parameter string representing the state of this frame. This string is useful for debugging.
Return Value:
Returns the parameter string of this frame.
Overrides:
paramString in class Container .
public void remove(MenuComponent m)Removes the specified menu bar from this frame.
Parameter Description m the menu component to remove.
public void setCursor(int cursorType)Sets the cursor image for this frame to be one of the predefined cursors.
Parameter Description cursorType one of the predefined cursor constants defined above (CROSSHAIR_CURSOR-WAIT_CURSOR).
public void setIconImage(Image image)Sets the image to display when this frame is iconized. The default icon is platform specific. Not all platforms support the concept of iconizing a window.
Parameter Description image the icon image to be displayed
public void setMenuBar(MenuBar mb)Sets the menubar of this frame to the specified menubar.
Parameter Description mb the new menubar
public void setResizable(boolean resizable)Determines whether this frame should be resizable. By default, a frame is resizable.
Parameter Description resizable true if this frame should be resizable; false otherwise
public void setTitle(String title)Sets the title of this frame to the specified title.
Parameter Description title the new title of this frame, or null to remove the title See Also: getTitle .