APIdia Launch Partner
Top Description Fields Constructors Methods
sun.swing

public final Class JLightweightFrame

extends LightweightFrame
implements RootPaneContainer
Class Inheritance
All Implemented Interfaces
javax.swing.RootPaneContainer
Annotations
@SuppressWarnings:serial
Imports
java.awt.*, java.awt.dnd.DragGestureEvent, .DragGestureListener, .DragGestureRecognizer, .DragSource, .DropTarget, .InvalidDnDOperationException, java.awt.dnd.peer.DragSourceContextPeer, java.awt.event.ContainerEvent, .ContainerListener, java.awt.geom.AffineTransform, java.awt.image.BufferedImage, .DataBufferInt, java.beans.PropertyChangeEvent, .PropertyChangeListener, javax.swing.JComponent, .JLayeredPane, .JPanel, .JRootPane, .LayoutFocusTraversalPolicy, .RepaintManager, .RootPaneContainer, .SwingUtilities, sun.awt.AWTAccessor, .DisplayChangedListener, .LightweightFrame, .OverrideNativeWindowHandle, sun.swing.SwingUtilities2.RepaintListener

The frame serves as a lightweight container which paints its content to an offscreen image and provides access to the image's data via the LightweightContent interface. Note, that it may not be shown as a standalone toplevel frame. Its purpose is to provide functionality for lightweight embedding.
Authors
Artem Ananiev, Anton Tarasov

Field Summary

Modifier and TypeField and Description
private BufferedImage
private Component
private LightweightContent
private JPanel
private int[]
private static boolean
copyBufferEnabled

copyBufferEnabled, true by default, defines the following strategy.

private PropertyChangeListener
private SwingUtilities2.RepaintListener
private final JRootPane
private volatile double
private volatile double

Constructor Summary

AccessConstructor and Description
public
JLightweightFrame()

Constructs a new, initially invisible JLightweightFrame instance.

Method Summary

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

Implements abstract sun.awt.LightweightFrame.addDropTarget.

Adds a drop target to the lightweight frame.

public void
addNotify()

Overrides sun.awt.LightweightFrame.addNotify.

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

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

Implements abstract sun.awt.LightweightFrame.createDragGestureRecognizer.

Create a drag gesture recognizer for the lightweight frame.

public DragSourceContextPeer
createDragSourceContextPeer(DragGestureEvent dge)

Implements abstract sun.awt.LightweightFrame.createDragSourceContextPeer.

Create a drag source context peer for the lightweight frame.

public void
dispose()

Overrides java.awt.Window.dispose.

Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children.

public Container
getContentPane()

Implements javax.swing.RootPaneContainer.getContentPane.

Returns the contentPane.

public Component
getGlassPane()

Implements javax.swing.RootPaneContainer.getGlassPane.

Returns the glassPane.

public Graphics
getGraphics()

Overrides sun.awt.LightweightFrame.getGraphics.

Creates a graphics context for this component.

public JLayeredPane
getLayeredPane()

Implements javax.swing.RootPaneContainer.getLayeredPane.

Returns the layeredPane.

public JRootPane
getRootPane()

Implements javax.swing.RootPaneContainer.getRootPane.

Return this component's single JRootPane child.

public int
getScaleFactor()

Implements abstract sun.awt.LightweightFrame.getScaleFactor.

Returns the scale factor of this frame.

public double
getScaleFactorX()

Implements abstract sun.awt.LightweightFrame.getScaleFactorX.

Returns the scale factor of this frame along x coordinate.

public double
getScaleFactorY()

Implements abstract sun.awt.LightweightFrame.getScaleFactorY.

Returns the scale factor of this frame along y coordinate.

public void
grabFocus()

Implements abstract sun.awt.LightweightFrame.grabFocus.

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

private void
public void
notifyDisplayChanged(final int scaleFactor)

Implements abstract sun.awt.LightweightFrame.notifyDisplayChanged.

Called when display of the hosted frame is changed.

public void
notifyDisplayChanged(final double scaleFactorX, final double scaleFactorY)

Implements abstract sun.awt.LightweightFrame.notifyDisplayChanged.

Called when display of the hosted frame is changed.

private void
notifyImageUpdated(int x, int y, int width, int height)

public void
overrideNativeWindowHandle(long handle, Runnable closeWindow)

public void
removeDropTarget(DropTarget dt)

Implements abstract sun.awt.LightweightFrame.removeDropTarget.

Removes a drop target from the lightweight frame.

public void
reshape(int x, int y, int width, int height)

Overrides java.awt.Window.reshape.

Reshapes the bounding rectangle for this component.

private void
resizeBuffer(int width, int height, double newScaleFactorX, double newScaleFactorY)

public void
setContent(final LightweightContent
the LightweightContent instance
content
)

Sets the LightweightContent instance for this frame.

public void
setContentPane(Container contentPane)

Implements javax.swing.RootPaneContainer.setContentPane.

The "contentPane" is the primary container for application specific components.

public void
setGlassPane(Component glassPane)

Implements javax.swing.RootPaneContainer.setGlassPane.

The glassPane is always the first child of the rootPane and the rootPanes layout manager ensures that it's always as big as the rootPane.

public void
setLayeredPane(JLayeredPane layeredPane)

Implements javax.swing.RootPaneContainer.setLayeredPane.

A Container that manages the contentPane and in some cases a menu bar.

private void
syncCopyBuffer(boolean reset, int x, int y, int w, int h, double scaleX, double scaleY)

public void
ungrabFocus()

Implements abstract sun.awt.LightweightFrame.ungrabFocus.

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

private void
Inherited from sun.awt.LightweightFrame:
emulateActivationgetHostBoundsgetParentisResizableremovesetHostBoundssetIconImagesetIconImagessetMenuBarsetResizablesetTitletoBacktoFront

Field Detail

bbImageback to summary
private BufferedImage bbImage
componentback to summary
private Component component

Hides java.awt.Container.component.

contentback to summary
private LightweightContent content
contentPaneback to summary
private JPanel contentPane
copyBufferback to summary
private int[] copyBuffer
copyBufferEnabledback to summary
private static boolean copyBufferEnabled

copyBufferEnabled, true by default, defines the following strategy. A duplicating (copy) buffer is created for the original pixel buffer. The copy buffer is synchronized with the original buffer every time the latter changes. JLightweightFrame passes the copy buffer array to the LightweightContent#imageBufferReset method. The code spot which synchronizes two buffers becomes the only critical section guarded by the lock (managed with the LightweightContent#paintLock(), LightweightContent#paintUnlock() methods).

layoutSizeListenerback to summary
private PropertyChangeListener layoutSizeListener
repaintListenerback to summary
private SwingUtilities2.RepaintListener repaintListener
rootPaneback to summary
private final JRootPane rootPane
scaleFactorXback to summary
private volatile double scaleFactorX
scaleFactorYback to summary
private volatile double scaleFactorY

Constructor Detail

JLightweightFrameback to summary
public JLightweightFrame()

Constructs a new, initially invisible JLightweightFrame instance.

Method Detail

addDropTargetback to summary
public void addDropTarget(DropTarget dt)

Implements abstract sun.awt.LightweightFrame.addDropTarget.

Doc from sun.awt.LightweightFrame.addDropTarget.

Adds a drop target to the lightweight frame.

addNotifyback to summary
public void addNotify()

Overrides sun.awt.LightweightFrame.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 <T extends DragGestureRecognizer> T createDragGestureRecognizer(Class<T> abstractRecognizerClass, DragSource ds, Component c, int srcActions, DragGestureListener dgl)

Implements abstract sun.awt.LightweightFrame.createDragGestureRecognizer.

Doc from sun.awt.LightweightFrame.createDragGestureRecognizer.

Create a drag gesture recognizer for the lightweight frame.

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

Implements abstract sun.awt.LightweightFrame.createDragSourceContextPeer.

Doc from sun.awt.LightweightFrame.createDragSourceContextPeer.

Create a drag source context peer for the lightweight frame.

disposeback to summary
public void dispose()

Overrides java.awt.Window.dispose.

Doc from java.awt.Window.dispose.

Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children. That is, the resources for these Components will be destroyed, any memory they consume will be returned to the OS, and they will be marked as undisplayable.

The Window and its subcomponents can be made displayable again by rebuilding the native resources with a subsequent call to pack or show. The states of the recreated Window and its subcomponents will be identical to the states of these objects at the point where the Window was disposed (not accounting for additional modifications between those actions).

Note

When the last displayable window within the Java virtual machine (VM) is disposed of, the VM may terminate. See AWT Threading Issues for more information.

Annotations
@Override
getContentPaneback to summary
public Container getContentPane()

Implements javax.swing.RootPaneContainer.getContentPane.

Doc from javax.swing.RootPaneContainer.getContentPane.

Returns the contentPane.

Annotations
@Override
getGlassPaneback to summary
public Component getGlassPane()

Implements javax.swing.RootPaneContainer.getGlassPane.

Doc from javax.swing.RootPaneContainer.getGlassPane.

Returns the glassPane.

Annotations
@Override
getGraphicsback to summary
public Graphics getGraphics()

Overrides sun.awt.LightweightFrame.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
getLayeredPaneback to summary
public JLayeredPane getLayeredPane()

Implements javax.swing.RootPaneContainer.getLayeredPane.

Doc from javax.swing.RootPaneContainer.getLayeredPane.

Returns the layeredPane.

Annotations
@Override
getRootPaneback to summary
public JRootPane getRootPane()

Implements javax.swing.RootPaneContainer.getRootPane.

Doc from javax.swing.RootPaneContainer.getRootPane.

Return this component's single JRootPane child. A conventional implementation of this interface will have all of the other methods indirect through this one. The rootPane has two children: the glassPane and the layeredPane.

Annotations
@Override
getScaleFactorback to summary
public int getScaleFactor()

Implements abstract sun.awt.LightweightFrame.getScaleFactor.

Doc from sun.awt.LightweightFrame.getScaleFactor.

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

Annotations
@Override
@SuppressWarnings:deprecation
getScaleFactorXback to summary
public double getScaleFactorX()

Implements abstract sun.awt.LightweightFrame.getScaleFactorX.

Doc from sun.awt.LightweightFrame.getScaleFactorX.

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

Annotations
@Override
getScaleFactorYback to summary
public double getScaleFactorY()

Implements abstract sun.awt.LightweightFrame.getScaleFactorY.

Doc from sun.awt.LightweightFrame.getScaleFactorY.

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

Annotations
@Override
grabFocusback to summary
public void grabFocus()

Implements abstract sun.awt.LightweightFrame.grabFocus.

Doc from sun.awt.LightweightFrame.grabFocus.

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

Annotations
@Override
See Also
LightweightContent#focusGrabbed()
initInteriorback to summary
private void initInterior()
notifyDisplayChangedback to summary
public void notifyDisplayChanged(final int scaleFactor)

Implements abstract sun.awt.LightweightFrame.notifyDisplayChanged.

Doc from sun.awt.LightweightFrame.notifyDisplayChanged.

Called when display of the hosted frame is changed.

Annotations
@Override
@SuppressWarnings:deprecation
notifyDisplayChangedback to summary
public void notifyDisplayChanged(final double scaleFactorX, final double scaleFactorY)

Implements abstract sun.awt.LightweightFrame.notifyDisplayChanged.

Doc from sun.awt.LightweightFrame.notifyDisplayChanged.

Called when display of the hosted frame is changed.

Annotations
@Override
notifyImageUpdatedback to summary
private void notifyImageUpdated(int x, int y, int width, int height)
overrideNativeWindowHandleback to summary
public void overrideNativeWindowHandle(long handle, Runnable closeWindow)
removeDropTargetback to summary
public void removeDropTarget(DropTarget dt)

Implements abstract sun.awt.LightweightFrame.removeDropTarget.

Doc from sun.awt.LightweightFrame.removeDropTarget.

Removes a drop target from the lightweight frame.

reshapeback to summary
public void reshape(int x, int y, int width, int height)

Overrides java.awt.Window.reshape.

Doc from java.awt.Component.reshape.

Reshapes the bounding rectangle for this component.

Annotations
@SuppressWarnings:deprecation
@Override
resizeBufferback to summary
private void resizeBuffer(int width, int height, double newScaleFactorX, double newScaleFactorY)
setContentback to summary
public void setContent(final LightweightContent content)

Sets the LightweightContent instance for this frame. The JComponent object returned by the LightweightContent#getComponent() method is immediately added to the frame's content pane.

Parameters
content:LightweightContent

the LightweightContent instance

setContentPaneback to summary
public void setContentPane(Container contentPane)

Implements javax.swing.RootPaneContainer.setContentPane.

Doc from javax.swing.RootPaneContainer.setContentPane.

The "contentPane" is the primary container for application specific components. Applications should add children to the contentPane, set its layout manager, and so on.

The contentPane may not be null.

Generally implemented with getRootPane().setContentPane(contentPane);

Annotations
@Override
setGlassPaneback to summary
public void setGlassPane(Component glassPane)

Implements javax.swing.RootPaneContainer.setGlassPane.

Doc from javax.swing.RootPaneContainer.setGlassPane.

The glassPane is always the first child of the rootPane and the rootPanes layout manager ensures that it's always as big as the rootPane. By default it's transparent and not visible. It can be used to temporarily grab all keyboard and mouse input by adding listeners and then making it visible. by default it's not visible.

The glassPane may not be null.

Generally implemented with getRootPane().setGlassPane(glassPane);

Annotations
@Override
setLayeredPaneback to summary
public void setLayeredPane(JLayeredPane layeredPane)

Implements javax.swing.RootPaneContainer.setLayeredPane.

Doc from javax.swing.RootPaneContainer.setLayeredPane.

A Container that manages the contentPane and in some cases a menu bar. The layeredPane can be used by descendants that want to add a child to the RootPaneContainer that isn't layout managed. For example an internal dialog or a drag and drop effect component.

The layeredPane may not be null.

Generally implemented with

   getRootPane().setLayeredPane(layeredPane);
Annotations
@Override
syncCopyBufferback to summary
private void syncCopyBuffer(boolean reset, int x, int y, int w, int h, double scaleX, double scaleY)
ungrabFocusback to summary
public void ungrabFocus()

Implements abstract sun.awt.LightweightFrame.ungrabFocus.

Doc from sun.awt.LightweightFrame.ungrabFocus.

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

Annotations
@Override
See Also
LightweightContent#focusUngrabbed()
updateClientCursorback to summary
private void updateClientCursor()