java.lang.Object | |||||
↳ | java.awt.Component | ||||
↳ | java.awt.Container | ||||
↳ | java.awt.Window | ||||
↳ | java.awt.Frame | ||||
↳ | sun.awt.EmbeddedFrame |
A generic container used for embedding Java components, usually applets. An EmbeddedFrame has two related uses: . Within a Java-based application, an EmbeddedFrame serves as a sort of firewall, preventing the contained components or applets from using getParent() to find parent components, such as menubars. . Within a C-based application, an EmbeddedFrame contains a window handle which was created by the application, which serves as the top-level Java window. EmbeddedFrames created for this purpose are passed-in a handle of an existing window created by the application. The window handle should be of the appropriate native type for a specific platform, as stored in the pData field of the ComponentPeer.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean | BACKWARD | ||||||||||
boolean | FORWARD |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.awt.Frame
| |||||||||||
From class
java.awt.Component
| |||||||||||
From interface
java.awt.image.ImageObserver
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This constructor is deprecated.
This constructor will be removed in 1.5
| |||||||||||
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Makes this Frame displayable by connecting it to
a native screen resource.
| |||||||||||
Need this method to detect when the focus may have chance to leave the
focus cycle root which is EmbeddedFrame.
| |||||||||||
Checks if the component is in an EmbeddedFrame.
| |||||||||||
Gets the cursor set in the component.
| |||||||||||
Block introspection of a parent window by this child.
| |||||||||||
This method is deprecated.
As of JDK version 1.5, replaced by
setVisible(boolean) .
| |||||||||||
Indicates whether this frame is resizable by the user.
| |||||||||||
This method should be overriden in subclasses.
| |||||||||||
Needed to track which KeyboardFocusManager is current.
| |||||||||||
Because there may be many AppContexts, and we can't be sure where this
EmbeddedFrame is first created or shown, we can't automatically determine
the correct KeyboardFocusManager to attach to as KeyEventDispatcher.
| |||||||||||
Removes the specified menu bar from this frame.
| |||||||||||
Sets the image to be displayed as the icon for this window.
| |||||||||||
Sets the sequence of images to be displayed as the icon
for this window.
| |||||||||||
Sets the menu bar for this frame to the specified menu bar.
| |||||||||||
Sets whether this frame is resizable by the user.
| |||||||||||
Block modifying any frame attributes, since they aren't applicable
for EmbeddedFrames.
| |||||||||||
This method is deprecated.
As of JDK version 1.5, replaced by
setVisible(boolean) .
| |||||||||||
Synthesize native message to activate or deactivate EmbeddedFrame window
depending on the value of parameter
b . | |||||||||||
If this Window is visible, sends this Window to the back and may cause
it to lose focus or activation if it is the focused or active Window.
| |||||||||||
If this Window is visible, brings this Window to the front and may make
it the focused Window.
| |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the bounds of this embedded frame as a rectangle specifying the
width, height and location relative to the native parent component.
| |||||||||||
Gets the location of this embedded frame as a point specifying the
top-left corner relative to parent component.
| |||||||||||
Moves and resizes this embedded frame.
| |||||||||||
Moves this embedded frame to a new location.
| |||||||||||
This method is called from dispatchKeyEvent in the following two cases:
1.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.awt.Frame
| |||||||||||
From class
java.awt.Window
| |||||||||||
From class
java.awt.Container
| |||||||||||
From class
java.awt.Component
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.awt.KeyEventDispatcher
| |||||||||||
From interface
java.awt.MenuContainer
| |||||||||||
From interface
java.awt.image.ImageObserver
| |||||||||||
From interface
java.beans.PropertyChangeListener
| |||||||||||
From interface
javax.accessibility.Accessible
|
This constructor is deprecated.
This constructor will be removed in 1.5
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.
Need this method to detect when the focus may have chance to leave the focus cycle root which is EmbeddedFrame. Mostly, the code here is copied from DefaultKeyboardFocusManager.processKeyEvent with some minor modifications.
e | the KeyEvent to dispatch |
---|
true
if the KeyboardFocusManager should take no
further action with regard to the KeyEvent; false
otherwiseChecks if the component is in an EmbeddedFrame. If so, returns the applet found in the hierarchy or null if not found.
Gets the cursor set in the component. If the component does
not have a cursor set, the cursor of its parent is returned.
If no cursor is set in the entire hierarchy,
Cursor.DEFAULT_CURSOR
is returned.
Block introspection of a parent window by this child.
This method is deprecated.
As of JDK version 1.5, replaced by
setVisible(boolean)
.
Needed to avoid memory leak: we register this EmbeddedFrame as a listener with KeyboardFocusManager of applet's AppContext. We don't want the KFM to keep reference to our EmbeddedFrame forever if the Frame is no longer in use, so we add listeners in show() and remove them in hide().
Indicates whether this frame is resizable by the user. By default, all frames are initially resizable.
true
if the user can resize this frame;
false
otherwise.This method should be overriden in subclasses. It is called when window this frame is within should be blocked by some modal dialog.
Needed to track which KeyboardFocusManager is current. We want to avoid memory leaks, so when KFM stops being current, we remove ourselves as listeners.
evt | A PropertyChangeEvent object describing the event source and the property that has changed. |
---|
Because there may be many AppContexts, and we can't be sure where this EmbeddedFrame is first created or shown, we can't automatically determine the correct KeyboardFocusManager to attach to as KeyEventDispatcher. Those who want to use the functionality of traversing out of the EmbeddedFrame must call this method on the Applet's AppContext. After that, all the changes can be handled automatically, including possible replacement of KeyboardFocusManager.
Removes the specified menu bar from this frame.
m | the menu component to remove.
If m is null , then
no action is taken
|
---|
Sets the image to be displayed as the icon for this window.
This method can be used instead of setIconImages()
to specify a single image as a window's icon.
The following statement:
setIconImage(image);is equivalent to:
ArrayList<Image> imageList = new ArrayList<Image>(); imageList.add(image); setIconImages(imageList);
Note : Native windowing systems may use different images of differing dimensions to represent a window, depending on the context (e.g. window decoration, window list, taskbar, etc.). They could also use just a single image for all contexts or no image at all.
image | the icon image to be displayed. |
---|
Sets the sequence of images to be displayed as the icon
for this window. Subsequent calls to getIconImages
will
always return a copy of the icons
list.
Depending on the platform capabilities one or several images of different dimensions will be used as the window's icon.
The icons
list is scanned for the images of most
appropriate dimensions from the beginning. If the list contains
several images of the same size, the first will be used.
Ownerless windows with no icon specified use platfrom-default icon.
The icon of an owned window may be inherited from the owner
unless explicitly overridden.
Setting the icon to null
or empty list restores
the default behavior.
Note : Native windowing systems may use different images of differing dimensions to represent a window, depending on the context (e.g. window decoration, window list, taskbar, etc.). They could also use just a single image for all contexts or no image at all.
icons | the list of icon images to be displayed. |
---|
Sets the menu bar for this frame to the specified menu bar.
mb | the menu bar being set.
If this parameter is null then any
existing menu bar on this frame is removed. |
---|
Sets whether this frame is resizable by the user.
resizable | true if this frame is resizable;
false otherwise. |
---|
Block modifying any frame attributes, since they aren't applicable for EmbeddedFrames.
title | the title to be displayed in the frame's border.
A null value
is treated as an empty string, "". |
---|
This method is deprecated.
As of JDK version 1.5, replaced by
setVisible(boolean)
.
Needed to avoid memory leak: we register this EmbeddedFrame as a listener with KeyboardFocusManager of applet's AppContext. We don't want the KFM to keep reference to our EmbeddedFrame forever if the Frame is no longer in use, so we add listeners in show() and remove them in hide().
Synthesize native message to activate or deactivate EmbeddedFrame window
depending on the value of parameter b
.
Peers should override this method if they are to implement
this functionality.
doActivate | if true , activates the window;
otherwise, deactivates the window
|
---|
If this Window is visible, sends this Window to the back and may cause it to lose focus or activation if it is the focused or active Window.
Places this Window at the bottom of the stacking order and shows it behind any other Windows in this VM. No action will take place is this Window is not visible. Some platforms do not allow Windows which are owned by other Windows to appear below their owners. Every attempt will be made to move this Window as low as possible in the stacking order; however, developers should not assume that this method will move this Window below all other windows in every situation.
Because of variations in native windowing systems, no guarantees about changes to the focused and active Windows can be made. Developers must never assume that this Window is no longer the focused or active Window until this Window receives a WINDOW_LOST_FOCUS or WINDOW_DEACTIVATED event. On platforms where the top-most window is the focused window, this method will probably cause this Window to lose focus. In that case, the next highest, focusable Window in this VM will receive focus. On platforms where the stacking order does not typically affect the focused window, this method will probably leave the focused and active Windows unchanged.
If this Window is visible, brings this Window to the front and may make it the focused Window.
Places this Window at the top of the stacking order and shows it in front of any other Windows in this VM. No action will take place if this Window is not visible. Some platforms do not allow Windows which own other Windows to appear on top of those owned Windows. Some platforms may not permit this VM to place its Windows above windows of native applications, or Windows of other VMs. This permission may depend on whether a Window in this VM is already focused. Every attempt will be made to move this Window as high as possible in the stacking order; however, developers should not assume that this method will move this Window above all other windows in every situation.
Because of variations in native windowing systems, no guarantees about changes to the focused and active Windows can be made. Developers must never assume that this Window is the focused or active Window until this Window receives a WINDOW_GAINED_FOCUS or WINDOW_ACTIVATED event. On platforms where the top-most window is the focused window, this method will probably focus this Window, if it is not already focused. On platforms where the stacking order does not typically affect the focused window, this method will probably leave the focused and active Windows unchanged.
If this method causes this Window to be focused, and this Window is a Frame or a Dialog, it will also become activated. If this Window is focused, but it is not a Frame or a Dialog, then the first Frame or Dialog that is an owner of this Window will be activated.
If this window is blocked by modal dialog, then the blocking dialog is brought to the front and remains above the blocked window.
Gets the bounds of this embedded frame as a rectangle specifying the width, height and location relative to the native parent component.
setLocation() and setBounds() for EmbeddedFrame really don't move it within the native parent. These methods always put embedded frame to (0, 0) for backward compatibility. To allow getting location and size of embedded frames getLocationPrivate() and getBoundsPrivate() were introduced, and they work just the same way as getLocation() and getBounds() for ususal, non-embedded components.
Using usual get/setLocation() and get/setBounds() together with new get/setLocationPrivate() and get/setBoundsPrivate() is not recommended. For example, calling getBoundsPrivate() after setLocation() works fine, but getBounds() after setBoundsPrivate() may return unpredictable value.
Gets the location of this embedded frame as a point specifying the top-left corner relative to parent component.
setLocation() and setBounds() for EmbeddedFrame really don't move it within the native parent. These methods always put embedded frame to (0, 0) for backward compatibility. To allow getting location and size of embedded frame getLocationPrivate() and getBoundsPrivate() were introduced, and they work just the same way as getLocation() and getBounds() for ususal, non-embedded components.
Using usual get/setLocation() and get/setBounds() together with new get/setLocationPrivate() and get/setBoundsPrivate() is not recommended. For example, calling getBoundsPrivate() after setLocation() works fine, but getBounds() after setBoundsPrivate() may return unpredictable value.
Moves and resizes this embedded frame. The new location of the top-left
corner is specified by x
and y
parameters
relative to the native parent component. The new size is specified by
width
and height
.
setLocation() and setBounds() for EmbeddedFrame really don't move it within the native parent. These methods always put embedded frame to (0, 0) for backward compatibility. To allow moving embedded frames setLocationPrivate() and setBoundsPrivate() were introduced, and they work just the same way as setLocation() and setBounds() for usual, non-embedded components.
Using usual get/setLocation() and get/setBounds() together with new get/setLocationPrivate() and get/setBoundsPrivate() is not recommended. For example, calling getBoundsPrivate() after setLocation() works fine, but getBounds() after setBoundsPrivate() may return unpredictable value.
x | the new x-coordinate relative to the parent component |
---|---|
y | the new y-coordinate relative to the parent component |
width | the new width of this embedded frame |
height | the new height of this embedded frame |
Moves this embedded frame to a new location. The top-left corner of
the new location is specified by the x
and y
parameters relative to the native parent component.
setLocation() and setBounds() for EmbeddedFrame really don't move it within the native parent. These methods always put embedded frame to (0, 0) for backward compatibility. To allow moving embedded frame setLocationPrivate() and setBoundsPrivate() were introduced, and they work just the same way as setLocation() and setBounds() for usual, non-embedded components.
Using usual get/setLocation() and get/setBounds() together with new get/setLocationPrivate() and get/setBoundsPrivate() is not recommended. For example, calling getBoundsPrivate() after setLocation() works fine, but getBounds() after setBoundsPrivate() may return unpredictable value.
x | the new x-coordinate relative to the parent component |
---|---|
y | the new y-coordinate relative to the parent component |
This method is called from dispatchKeyEvent in the following two cases: 1. The focus is on the first Component of this EmbeddedFrame and we are about to transfer the focus backward. 2. The focus in on the last Component of this EmbeddedFrame and we are about to transfer the focus forward. This is needed to give the opportuity for keyboard focus to leave the EmbeddedFrame. Override this method, initiate focus transfer in it and return true if you want the focus to leave EmbeddedFrame's cycle. The direction parameter specifies which of the two mentioned cases is happening. Use FORWARD and BACKWARD constants defined in EmbeddedFrame to avoid confusing boolean values.
direction | FORWARD or BACKWARD |
---|