Fields Summary |
---|
public static final int | DEFAULT_CURSOR |
public static final int | CROSSHAIR_CURSOR |
public static final int | TEXT_CURSOR |
public static final int | WAIT_CURSOR |
public static final int | SW_RESIZE_CURSOR |
public static final int | SE_RESIZE_CURSOR |
public static final int | NW_RESIZE_CURSOR |
public static final int | NE_RESIZE_CURSOR |
public static final int | N_RESIZE_CURSOR |
public static final int | S_RESIZE_CURSOR |
public static final int | W_RESIZE_CURSOR |
public static final int | E_RESIZE_CURSOR |
public static final int | HAND_CURSOR |
public static final int | MOVE_CURSOR |
public static final int | NORMALFrame is in the "normal" state. This symbolic constant names a
frame state with all state bits cleared. |
public static final int | ICONIFIEDThis state bit indicates that frame is iconified. |
public static final int | MAXIMIZED_HORIZThis state bit indicates that frame is maximized in the
horizontal direction. |
public static final int | MAXIMIZED_VERTThis state bit indicates that frame is maximized in the
vertical direction. |
public static final int | MAXIMIZED_BOTHThis state bit mask indicates that frame is fully maximized
(that is both horizontally and vertically). It is just a
convenience alias for
MAXIMIZED_VERT | MAXIMIZED_HORIZ .
Note that the correct test for frame being fully maximized is
(state & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH
To test is frame is maximized in some direction use
(state & Frame.MAXIMIZED_BOTH) != 0
|
Rectangle | maximizedBoundsMaximized bounds for this frame. |
String | titleThis is the title of the frame. It can be changed
at any time. title can be null and if
this is the case the title = "". |
transient Image | iconicon is the graphical way we can
represent the frame.
icon can be null, but obviously if
you try to set the icon image icon
cannot be null. |
MenuBar | menuBarThe frames menubar. If menuBar = null
the frame will not have a menubar. |
boolean | resizableThis field indicates whether the frame is resizable.
This property can be changed at any time.
resizable will be true if the frame is
resizable, otherwise it will be false. |
boolean | undecoratedThis field indicates whether the frame is undecorated.
This property can only be changed while the frame is not displayable.
undecorated will be true if the frame is
undecorated, otherwise it will be false. |
boolean | mbManagementmbManagement is only used by the Motif implementation. |
private int | state |
Vector | ownedWindows |
private transient WeakReference | weakThis |
private static final String | base |
private static int | nameCounter |
private static final long | serialVersionUID |
private int | frameSerializedDataVersionFrame 's Serialized Data Version. |
Methods Summary |
---|
public void | addNotify()Makes this Frame displayable by connecting it to
a native screen resource. Making a frame displayable will
cause any of its children to be made displayable.
This method is called internally by the toolkit and should
not be called directly by programs.
synchronized (getTreeLock()) {
if (peer == null) {
peer = getToolkit().createFrame(this);
}
FramePeer p = (FramePeer)peer;
MenuBar menuBar = this.menuBar;
if (menuBar != null) {
mbManagement = true;
menuBar.addNotify();
p.setMenuBar(menuBar);
}
p.setMaximizedBounds(maximizedBounds);
super.addNotify();
}
|
void | addToFrameList()
synchronized (Frame.class) {
Vector frameList = (Vector)appContext.get(Frame.class);
if (frameList == null) {
frameList = new Vector();
appContext.put(Frame.class, frameList);
}
frameList.addElement(weakThis);
}
|
java.lang.String | constructComponentName()Construct a name for this component. Called by getName() when the
name is null.
synchronized (getClass()) {
return base + nameCounter++;
}
|
protected void | finalize()Disposes of the input methods and context, and removes
this Frame from the AppContext. Subclasses that override
this method should call super.finalize().
// We have to remove the (hard) reference to weakThis in the
// AppContext's Frame list Vector, otherwise the WeakReference
// instance that points to this Frame will never get garbage
// collected.
removeFromFrameList();
super.finalize();
|
public javax.accessibility.AccessibleContext | getAccessibleContext()Gets the AccessibleContext associated with this Frame.
For frames, the AccessibleContext takes the form of an
AccessibleAWTFrame.
A new AccessibleAWTFrame instance is created if necessary.
if (accessibleContext == null) {
accessibleContext = new AccessibleAWTFrame();
}
return accessibleContext;
|
public int | getCursorType()
return (getCursor().getType());
|
public synchronized int | getExtendedState()Gets the state of this frame. The state is
represented as a bitwise mask.
NORMAL
Indicates that no state bits are set.
ICONIFIED
MAXIMIZED_HORIZ
MAXIMIZED_VERT
MAXIMIZED_BOTH
Concatenates MAXIMIZED_HORIZ
and MAXIMIZED_VERT .
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
state = peer.getState();
}
return state;
|
public static java.awt.Frame[] | getFrames()Returns an array containing all Frames created by the application.
If called from an applet, the array will only include the Frames
accessible by that applet.
synchronized (Frame.class) {
Frame realCopy[];
Vector frameList =
(Vector)AppContext.getAppContext().get(Frame.class);
if (frameList != null) {
// Recall that frameList is actually a Vector of WeakReferences
// and calling get() on one of these references may return
// null. Make two arrays-- one the size of the Vector
// (fullCopy with size fullSize), and one the size of all
// non-null get()s (realCopy with size realSize).
int fullSize = frameList.size();
int realSize = 0;
Frame fullCopy[] = new Frame[fullSize];
for (int i = 0; i < fullSize; i++) {
fullCopy[realSize] = (Frame)
(((WeakReference) (frameList.elementAt(i))).get());
if (fullCopy[realSize] != null) {
realSize++;
}
}
if (fullSize != realSize) {
realCopy = new Frame[realSize];
System.arraycopy(fullCopy, 0, realCopy, 0, realSize);
} else {
realCopy = fullCopy;
}
} else {
realCopy = new Frame[0];
}
return realCopy;
}
|
public java.awt.Image | getIconImage()Gets the image to be displayed in the minimized icon
for this frame.
return icon;
|
public java.awt.Rectangle | getMaximizedBounds()Gets maximized bounds for this frame.
Some fields may contain Integer.MAX_VALUE to indicate
that system supplied values for this field must be used.
return maximizedBounds;
|
public java.awt.MenuBar | getMenuBar()Gets the menu bar for this frame.
return menuBar;
|
public synchronized int | getState()Gets the state of this frame (obsolete).
In older versions of JDK a frame state could only be NORMAL or
ICONIFIED. Since JDK 1.4 set of supported frame states is
expanded and frame state is represented as a bitwise mask.
For compatibility with old programs this method still returns
Frame.NORMAL and Frame.ICONIFIED but
it only reports the iconic state of the frame, other aspects of
frame state are not reported by this method.
return (getExtendedState() & ICONIFIED) != 0 ? ICONIFIED : NORMAL;
|
public java.lang.String | getTitle()Gets the title of the frame. The title is displayed in the
frame's border.
return title;
|
private void | init(java.lang.String title, java.awt.GraphicsConfiguration gc)
this.title = title;
weakThis = new WeakReference(this);
addToFrameList();
SunToolkit.checkAndSetPolicy(this, false);
|
private static native void | initIDs()Initialize JNI field and method IDs
|
private boolean | isFrameStateSupported(int state)
if( !getToolkit().isFrameStateSupported( state ) ) {
// * Toolkit.isFrameStateSupported returns always false
// on compound state even if all parts are supported;
// * if part of state is not supported, state is not supported;
// * MAXIMIZED_BOTH is not a compound state.
if( ((state & ICONIFIED) != 0) &&
!getToolkit().isFrameStateSupported( ICONIFIED )) {
return false;
}else {
state &= ~ICONIFIED;
}
return getToolkit().isFrameStateSupported( state );
}
return true;
|
public boolean | isResizable()Indicates whether this frame is resizable by the user.
By default, all frames are initially resizable.
return resizable;
|
public boolean | isUndecorated()Indicates whether this frame is undecorated.
By default, all frames are initially decorated.
return undecorated;
|
protected java.lang.String | paramString()Returns a string representing the state of this Frame .
This method is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not be
null .
String str = super.paramString();
if (title != null) {
str += ",title=" + title;
}
if (resizable) {
str += ",resizable";
}
getExtendedState(); // sync with peer
if (state == NORMAL) {
str += ",normal";
}
else {
if ((state & ICONIFIED) != 0) {
str += ",iconified";
}
if ((state & MAXIMIZED_BOTH) == MAXIMIZED_BOTH) {
str += ",maximized";
}
else if ((state & MAXIMIZED_HORIZ) != 0) {
str += ",maximized_horiz";
}
else if ((state & MAXIMIZED_VERT) != 0) {
str += ",maximized_vert";
}
}
return str;
|
void | postProcessKeyEvent(java.awt.event.KeyEvent e)
if (menuBar != null && menuBar.handleShortcut(e)) {
e.consume();
return;
}
super.postProcessKeyEvent(e);
|
private void | readObject(java.io.ObjectInputStream s)Reads the ObjectInputStream . Tries
to read an Icon , which is optional
data available as of 1.4. If an Icon
is not available, but anything other than an EOF
is detected, an OptionalDataException
will be thrown..
Unrecognized keys or values will be ignored.
// HeadlessException is thrown by Window's readObject
s.defaultReadObject();
try {
icon = (Image) s.readObject();
} catch (java.io.OptionalDataException e) {
// pre-1.4 instances will not have this optional data.
// e.eof will be true to indicate that there is no more
// data available for this object.
// If e.eof is not true, throw the exception as it
// might have been caused by unrelated reasons.
if (!e.eof) {
throw (e);
}
}
if (menuBar != null)
menuBar.parent = this;
// Ensure 1.1 serialized Frames can read & hook-up
// owned windows properly
//
if (ownedWindows != null) {
for (int i = 0; i < ownedWindows.size(); i++) {
connectOwnedWindow((Window) ownedWindows.elementAt(i));
}
ownedWindows = null;
}
weakThis = new WeakReference(this);
addToFrameList();
|
public void | remove(java.awt.MenuComponent m)Removes the specified menu bar from this frame.
synchronized (getTreeLock()) {
if (m == menuBar) {
menuBar = null;
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
mbManagement = true;
if (valid) {
invalidate();
}
peer.setMenuBar(null);
m.removeNotify();
}
m.parent = null;
} else {
super.remove(m);
}
}
|
void | removeFromFrameList()
synchronized (Frame.class) {
Vector frameList = (Vector)appContext.get(Frame.class);
if (frameList != null) {
frameList.removeElement(weakThis);
}
}
|
public void | removeNotify()Makes this Frame undisplayable by removing its connection
to its native screen resource. Making a Frame undisplayable
will cause any of its children to be made undisplayable.
This method is called by the toolkit internally and should
not be called directly by programs.
synchronized (getTreeLock()) {
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
// get the latest Frame state before disposing
getState();
if (menuBar != null) {
mbManagement = true;
peer.setMenuBar(null);
menuBar.removeNotify();
}
}
super.removeNotify();
}
|
public void | setCursor(int cursorType)
if (cursorType < DEFAULT_CURSOR || cursorType > MOVE_CURSOR) {
throw new IllegalArgumentException("illegal cursor type");
}
setCursor(Cursor.getPredefinedCursor(cursorType));
|
public synchronized void | setExtendedState(int state)Sets the state of this frame. The state is
represented as a bitwise mask.
NORMAL
Indicates that no state bits are set.
ICONIFIED
MAXIMIZED_HORIZ
MAXIMIZED_VERT
MAXIMIZED_BOTH
Concatenates MAXIMIZED_HORIZ
and MAXIMIZED_VERT .
Note that if the state is not supported on a
given platform, nothing will happen. The application
may determine if a specific state is available via
the java.awt.Toolkit#isFrameStateSupported(int state)
method.
if ( !isFrameStateSupported( state ) ) {
return;
}
this.state = state;
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
peer.setState(state);
}
|
public synchronized void | setIconImage(java.awt.Image image)Sets the image to be displayed in the minimized icon for this frame.
Not all platforms support the concept of minimizing a window.
this.icon = image;
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
peer.setIconImage(image);
}
|
public synchronized void | setMaximizedBounds(java.awt.Rectangle bounds)Sets the maximized bounds for this frame.
When a frame is in maximized state the system supplies some
defaults bounds. This method allows some or all of those
system supplied values to be overridden.
If bounds is null , accept bounds
supplied by the system. If non-null you can
override some of the system supplied values while accepting
others by setting those fields you want to accept from system
to Integer.MAX_VALUE .
On some systems only the size portion of the bounds is taken
into account.
this.maximizedBounds = bounds;
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
peer.setMaximizedBounds(bounds);
}
|
public void | setMenuBar(java.awt.MenuBar mb)Sets the menu bar for this frame to the specified menu bar.
synchronized (getTreeLock()) {
if (menuBar == mb) {
return;
}
if ((mb != null) && (mb.parent != null)) {
mb.parent.remove(mb);
}
if (menuBar != null) {
remove(menuBar);
}
menuBar = mb;
if (menuBar != null) {
menuBar.parent = this;
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
mbManagement = true;
menuBar.addNotify();
if (valid) {
invalidate();
}
peer.setMenuBar(menuBar);
}
}
}
|
public void | setResizable(boolean resizable)Sets whether this frame is resizable by the user.
boolean oldResizable = this.resizable;
boolean testvalid = false;
synchronized (this) {
this.resizable = resizable;
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
peer.setResizable(resizable);
testvalid = true;
}
}
// On some platforms, changing the resizable state affects
// the insets of the Frame. If we could, we'd call invalidate()
// from the peer, but we need to guarantee that we're not holding
// the Frame lock when we call invalidate().
if (testvalid && valid) {
invalidate();
}
firePropertyChange("resizable", oldResizable, resizable);
|
public synchronized void | setState(int state)Sets the state of this frame (obsolete).
In older versions of JDK a frame state could only be NORMAL or
ICONIFIED. Since JDK 1.4 set of supported frame states is
expanded and frame state is represented as a bitwise mask.
For compatibility with old programs this method still accepts
Frame.NORMAL and Frame.ICONIFIED but
it only changes the iconic state of the frame, other aspects of
frame state are not affected by this method.
int current = getExtendedState();
if (state == ICONIFIED && (current & ICONIFIED) == 0) {
setExtendedState(current | ICONIFIED);
}
else if (state == NORMAL && (current & ICONIFIED) != 0) {
setExtendedState(current & ~ICONIFIED);
}
|
public void | setTitle(java.lang.String title)Sets the title for this frame to the specified string.
String oldTitle = this.title;
if (title == null) {
title = "";
}
synchronized(this) {
this.title = title;
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
peer.setTitle(title);
}
}
firePropertyChange("title", oldTitle, title);
|
public void | setUndecorated(boolean undecorated)Disables or enables decorations for this frame.
This method can only be called while the frame is not displayable.
/* Make sure we don't run in the middle of peer creation.*/
synchronized (getTreeLock()) {
if (isDisplayable()) {
throw new IllegalComponentStateException("The frame is displayable.");
}
this.undecorated = undecorated;
}
|
private void | writeObject(java.io.ObjectOutputStream s)Writes default serializable fields to stream. Writes
an optional serializable Icon , which is
available as of 1.4.
s.defaultWriteObject();
if (icon instanceof Serializable) {
s.writeObject(icon);
}
else
{
s.writeObject(null);
}
|