APIdia Launch Partner
Top Description Fields Constructors Methods
sun.awt

public abstract Class LightweightFrame

extends Frame
Class Inheritance
Known Direct Subclasses
sun.swing.JLightweightFrame
Annotations
@SuppressWarnings:serial
Imports
java.awt.Component, .Container, .Frame, .Graphics, .Image, .MenuBar, .MenuComponent, .Rectangle, .Toolkit, java.awt.dnd.DragGestureEvent, .DragGestureListener, .DragGestureRecognizer, .DragSource, .DropTarget, .InvalidDnDOperationException, java.awt.dnd.peer.DragSourceContextPeer, java.awt.peer.FramePeer

The class provides basic functionality for a lightweight frame implementation. A subclass is expected to provide painting to an offscreen image and access to it. Thus it can be used for lightweight embedding.
Authors
Artem Ananiev, Anton Tarasov

Field Summary

Modifier and TypeField and Description
private int
hostH

Host window absolute bounds.

private int
hostW

Host window absolute bounds.

private int
hostX

Host window absolute bounds.

private int
hostY

Host window absolute bounds.

Inherited from java.awt.Frame:
CROSSHAIR_CURSORDEFAULT_CURSORE_RESIZE_CURSORHAND_CURSORICONIFIEDMAXIMIZED_BOTHMAXIMIZED_HORIZMAXIMIZED_VERTMOVE_CURSORN_RESIZE_CURSORNE_RESIZE_CURSORNORMALNW_RESIZE_CURSORS_RESIZE_CURSORSE_RESIZE_CURSORSW_RESIZE_CURSORTEXT_CURSORW_RESIZE_CURSORWAIT_CURSOR

Constructor Summary

AccessConstructor and Description
public
LightweightFrame()

Constructs a new, initially invisible LightweightFrame instance.

Method Summary

Modifier and TypeMethod and Description
public abstract void
addDropTarget(DropTarget dt)

Adds a drop target to the lightweight frame.

public void
addNotify()

Overrides java.awt.Frame.addNotify.

Makes this Frame displayable by connecting it to a native screen resource.

public abstract <T extends DragGestureRecognizer> T
createDragGestureRecognizer(Class<T> abstractRecognizerClass, DragSource ds, Component c, int srcActions, DragGestureListener dgl)

Create a drag gesture recognizer for the lightweight frame.

public abstract DragSourceContextPeer
createDragSourceContextPeer(DragGestureEvent dge)

Create a drag source context peer for the lightweight frame.

public void
emulateActivation(boolean
if true, activates the frame; otherwise, deactivates the frame
activate
)

Requests the peer to emulate activation or deactivation of the frame.

public Graphics
getGraphics()

Overrides java.awt.Component.getGraphics.

Creates a graphics context for this component.

public Rectangle

Returns:

the host window bounds
getHostBounds
()

Returns the absolute bounds of the host (embedding) window.

public final Container

Returns:

null
getParent
()

Overrides java.awt.Component.getParent.

Blocks introspection of a parent window by this child.

public abstract int

Returns:

the scale factor
getScaleFactor
()
Deprecated since 9. replaced by getScaleFactorX() and getScaleFactorY

Returns the scale factor of this frame.

public abstract double

Returns:

the x coordinate scale factor
getScaleFactorX
()

Returns the scale factor of this frame along x coordinate.

public abstract double

Returns:

the y coordinate scale factor
getScaleFactorY
()

Returns the scale factor of this frame along y coordinate.

public abstract void
grabFocus()

Delegates the focus grab action to the client (embedding) application.

public final boolean
isResizable()

Overrides java.awt.Frame.isResizable.

Indicates whether this frame is resizable by the user.

public abstract void
notifyDisplayChanged(int
the scale factor
scaleFactor
)
Deprecated since 9. replaced by notifyDisplayChanged(double, double)

Called when display of the hosted frame is changed.

public abstract void
notifyDisplayChanged(double
the scale factor
scaleFactorX
,
double
the scale factor
scaleFactorY
)

Called when display of the hosted frame is changed.

public final void
remove(MenuComponent m)

Overrides java.awt.Frame.remove.

Implements java.awt.MenuContainer.remove.

Removes the specified menu bar from this frame.

public abstract void
removeDropTarget(DropTarget dt)

Removes a drop target from the lightweight frame.

public void
setHostBounds(int x, int y, int w, int h)

Sets the absolute bounds of the host (embedding) window.

public final void
setIconImage(Image image)

Overrides java.awt.Frame.setIconImage.

Sets the image to be displayed as the icon for this window.

public final void
setIconImages(List<? extends Image> icons)

Overrides java.awt.Window.setIconImages.

Sets the sequence of images to be displayed as the icon for this window.

public final void
setMenuBar(MenuBar mb)

Overrides java.awt.Frame.setMenuBar.

Sets the menu bar for this frame to the specified menu bar.

private void
setPeer(final FramePeer p)

public final void
setResizable(boolean resizable)

Overrides java.awt.Frame.setResizable.

Sets whether this frame is resizable by the user.

public final void
setTitle(String title)

Overrides java.awt.Frame.setTitle.

Sets the title for this frame to the specified string.

public final void
toBack()

Overrides java.awt.Window.toBack.

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.

public final void
toFront()

Overrides java.awt.Window.toFront.

If this Window is visible, brings this Window to the front and may make it the focused Window.

public abstract void
ungrabFocus()

Delegates the focus ungrab action to the client (embedding) application.

Inherited from java.awt.Frame:
getAccessibleContextgetCursorTypegetExtendedStategetFramesgetIconImagegetMaximizedBoundsgetMenuBargetStategetTitleisUndecoratedparamStringremoveNotifysetBackgroundsetCursorsetExtendedStatesetMaximizedBoundssetOpacitysetShapesetStatesetUndecorated

Field Detail

hostHback to summary
private int hostH

Host window absolute bounds.

hostWback to summary
private int hostW

Host window absolute bounds.

hostXback to summary
private int hostX

Host window absolute bounds.

hostYback to summary
private int hostY

Host window absolute bounds.

Constructor Detail

LightweightFrameback to summary
public LightweightFrame()

Constructs a new, initially invisible LightweightFrame instance.

Method Detail

addDropTargetback to summary
public abstract void addDropTarget(DropTarget dt)

Adds a drop target to the lightweight frame.

addNotifyback to summary
public void addNotify()

Overrides java.awt.Frame.addNotify.

Doc from java.awt.Frame.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.

Annotations
@Override
createDragGestureRecognizerback to summary
public abstract <T extends DragGestureRecognizer> T createDragGestureRecognizer(Class<T> abstractRecognizerClass, DragSource ds, Component c, int srcActions, DragGestureListener dgl)

Create a drag gesture recognizer for the lightweight frame.

createDragSourceContextPeerback to summary
public abstract DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException

Create a drag source context peer for the lightweight frame.

emulateActivationback to summary
public void emulateActivation(boolean activate)

Requests the peer to emulate activation or deactivation of the frame. Peers should override this method if they are to implement this functionality.

Parameters
activate:boolean

if true, activates the frame; otherwise, deactivates the frame

getGraphicsback to summary
public Graphics getGraphics()

Overrides java.awt.Component.getGraphics.

Doc from java.awt.Component.getGraphics.

Creates a graphics context for this component. This method will return null if this component is currently not displayable.

Annotations
@Override
getHostBoundsback to summary
public Rectangle getHostBounds()

Returns the absolute bounds of the host (embedding) window.

Returns:Rectangle

the host window bounds

getParentback to summary
public final Container getParent()

Overrides java.awt.Component.getParent.

Blocks introspection of a parent window by this child.

Returns:Container

null

Annotations
@Override
getScaleFactorback to summary
public abstract int getScaleFactor()

Deprecated

since 9.

replaced by getScaleFactorX() and getScaleFactorY

Returns the scale factor of this frame. The default value is 1.

Returns:int

the scale factor

Annotations
@Deprecated
since:9
See Also
notifyDisplayChanged(int)
getScaleFactorXback to summary
public abstract double getScaleFactorX()

Returns the scale factor of this frame along x coordinate. The default value is 1.

Returns:double

the x coordinate scale factor

Since
9
See Also
notifyDisplayChanged(double, double)
getScaleFactorYback to summary
public abstract double getScaleFactorY()

Returns the scale factor of this frame along y coordinate. The default value is 1.

Returns:double

the y coordinate scale factor

Since
9
See Also
notifyDisplayChanged(double, double)
grabFocusback to summary
public abstract void grabFocus()

Delegates the focus grab action to the client (embedding) application. The method is called by the AWT grab machinery.

See Also
SunToolkit#grab(java.awt.Window)
isResizableback to summary
public final boolean isResizable()

Overrides java.awt.Frame.isResizable.

Doc from java.awt.Frame.isResizable.

Indicates whether this frame is resizable by the user. By default, all frames are initially resizable.

Annotations
@Override
notifyDisplayChangedback to summary
public abstract void notifyDisplayChanged(int scaleFactor)

Deprecated

since 9.

replaced by notifyDisplayChanged(double, double)

Called when display of the hosted frame is changed.

Parameters
scaleFactor:int

the scale factor

Annotations
@Deprecated
since:9
notifyDisplayChangedback to summary
public abstract void notifyDisplayChanged(double scaleFactorX, double scaleFactorY)

Called when display of the hosted frame is changed.

Parameters
scaleFactorX:double

the scale factor

scaleFactorY:double

the scale factor

Since
9
removeback to summary
public final void remove(MenuComponent m)

Overrides java.awt.Frame.remove.

Implements java.awt.MenuContainer.remove.

Doc from java.awt.Frame.remove.

Removes the specified menu bar from this frame.

Annotations
@Override
removeDropTargetback to summary
public abstract void removeDropTarget(DropTarget dt)

Removes a drop target from the lightweight frame.

setHostBoundsback to summary
public void setHostBounds(int x, int y, int w, int h)

Sets the absolute bounds of the host (embedding) window.

setIconImageback to summary
public final void setIconImage(Image image)

Overrides java.awt.Frame.setIconImage.

Doc from java.awt.Frame.setIconImage.

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.

Annotations
@Override
setIconImagesback to summary
public final void setIconImages(List<? extends Image> icons)

Overrides java.awt.Window.setIconImages.

Doc from java.awt.Window.setIconImages.

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 can contain MultiResolutionImage images also. Suitable image depending on screen resolution is extracted from base MultiResolutionImage image and added to the icons list while base resolution image is removed from list. 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 platform-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.

Annotations
@Override
setMenuBarback to summary
public final void setMenuBar(MenuBar mb)

Overrides java.awt.Frame.setMenuBar.

Doc from java.awt.Frame.setMenuBar.

Sets the menu bar for this frame to the specified menu bar.

Annotations
@Override
setPeerback to summary
private void setPeer(final FramePeer p)
setResizableback to summary
public final void setResizable(boolean resizable)

Overrides java.awt.Frame.setResizable.

Doc from java.awt.Frame.setResizable.

Sets whether this frame is resizable by the user.

Annotations
@Override
setTitleback to summary
public final void setTitle(String title)

Overrides java.awt.Frame.setTitle.

Doc from java.awt.Frame.setTitle.

Sets the title for this frame to the specified string.

Annotations
@Override
toBackback to summary
public final void toBack()

Overrides java.awt.Window.toBack.

Doc from java.awt.Window.toBack.

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.

Annotations
@Override
toFrontback to summary
public final void toFront()

Overrides java.awt.Window.toFront.

Doc from java.awt.Window.toFront.

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.

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) under the following conditions:

  • The window meets the requirements outlined in the isFocusableWindow method.
  • The window's property autoRequestFocus is of the true value.
  • Native windowing system allows the window to get 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.

Annotations
@Override
ungrabFocusback to summary
public abstract void ungrabFocus()

Delegates the focus ungrab action to the client (embedding) application. The method is called by the AWT grab machinery.

See Also
SunToolkit#ungrab(java.awt.Window)