DefaultDesktopManager (Java 2 Platform SE 5.0) (original) (raw)


javax.swing

Class DefaultDesktopManager

java.lang.Object extended by javax.swing.DefaultDesktopManager

All Implemented Interfaces:

Serializable, DesktopManager


public class DefaultDesktopManager

extends Object

implements DesktopManager, Serializable

This is an implementation of the DesktopManager. It currently implements the basic behaviors for managingJInternalFrames in an arbitrary parent.JInternalFrames that are not children of aJDesktop will use this component to handle their desktop-like actions.

This class provides a policy for the various JInternalFrame methods, it is not meant to be called directly rather the various JInternalFrame methods will call into the DesktopManager.

See Also:

JDesktopPane, JInternalFrame


Constructor Summary
DefaultDesktopManager()
Method Summary
void activateFrame(JInternalFrame f) This will activate f moving it to the front.
void beginDraggingFrame(JComponent f) This method is normally called when the user has indicated that they will begin dragging a component around.
void [beginResizingFrame](../../javax/swing/DefaultDesktopManager.html#beginResizingFrame%28javax.swing.JComponent, int%29)(JComponent f, int direction) This methods is normally called when the user has indicated that they will begin resizing the frame.
void closeFrame(JInternalFrame f) Removes the frame, and, if necessary, thedesktopIcon, from its parent.
void deactivateFrame(JInternalFrame f) Generally, indicate that this frame has lost focus.
void deiconifyFrame(JInternalFrame f) Removes the desktopIcon from its parent and adds its frame to the parent.
void [dragFrame](../../javax/swing/DefaultDesktopManager.html#dragFrame%28javax.swing.JComponent, int, int%29)(JComponent f, int newX, int newY) Moves the visible location of the frame being dragged to the location specified.
void endDraggingFrame(JComponent f) This method signals the end of the dragging session.
void endResizingFrame(JComponent f) This method signals the end of the resize session.
protected Rectangle getBoundsForIconOf(JInternalFrame f) The iconifyFrame() code calls this to determine the proper bounds for the desktopIcon.
protected Rectangle getPreviousBounds(JInternalFrame f) Gets the normal bounds of the component prior to the component being maximized.
void iconifyFrame(JInternalFrame f) Removes the frame from its parent and adds itsdesktopIcon to the parent.
void maximizeFrame(JInternalFrame f) Resizes the frame to fill its parents bounds.
void minimizeFrame(JInternalFrame f) Restores the frame back to its size and position prior to a maximizeFrame call.
void openFrame(JInternalFrame f) Normally this method will not be called.
protected void removeIconFor(JInternalFrame f) Convenience method to remove the desktopIcon of f is necessary.
void [resizeFrame](../../javax/swing/DefaultDesktopManager.html#resizeFrame%28javax.swing.JComponent, int, int, int, int%29)(JComponent f, int newX, int newY, int newWidth, int newHeight) Calls setBoundsForFrame with the new values.
void [setBoundsForFrame](../../javax/swing/DefaultDesktopManager.html#setBoundsForFrame%28javax.swing.JComponent, int, int, int, int%29)(JComponent f, int newX, int newY, int newWidth, int newHeight) This moves the JComponent and repaints the damaged areas.
protected void [setPreviousBounds](../../javax/swing/DefaultDesktopManager.html#setPreviousBounds%28javax.swing.JInternalFrame, java.awt.Rectangle%29)(JInternalFrame f,Rectangle r) Stores the bounds of the component just before a maximize call.
protected void [setWasIcon](../../javax/swing/DefaultDesktopManager.html#setWasIcon%28javax.swing.JInternalFrame, java.lang.Boolean%29)(JInternalFrame f,Boolean value) Sets that the component has been iconized and the bounds of thedesktopIcon are valid.
protected boolean wasIcon(JInternalFrame f) Returns true if the component has been iconized and the bounds of the desktopIcon are valid, otherwise returns false.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, [wait](../../java/lang/Object.html#wait%28long, int%29)
Constructor Detail

DefaultDesktopManager

public DefaultDesktopManager()

Method Detail

openFrame

public void openFrame(JInternalFrame f)

Normally this method will not be called. If it is, it try to determine the appropriate parent from the desktopIcon of the frame. Will remove the desktopIcon from its parent if it successfully adds the frame.

Specified by:

[openFrame](../../javax/swing/DesktopManager.html#openFrame%28javax.swing.JInternalFrame%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")


closeFrame

public void closeFrame(JInternalFrame f)

Removes the frame, and, if necessary, thedesktopIcon, from its parent.

Specified by:

[closeFrame](../../javax/swing/DesktopManager.html#closeFrame%28javax.swing.JInternalFrame%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")

Parameters:

f - the JInternalFrame to be removed


maximizeFrame

public void maximizeFrame(JInternalFrame f)

Resizes the frame to fill its parents bounds.

Specified by:

[maximizeFrame](../../javax/swing/DesktopManager.html#maximizeFrame%28javax.swing.JInternalFrame%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")

Parameters:

f - the frame to be resized


minimizeFrame

public void minimizeFrame(JInternalFrame f)

Restores the frame back to its size and position prior to a maximizeFrame call.

Specified by:

[minimizeFrame](../../javax/swing/DesktopManager.html#minimizeFrame%28javax.swing.JInternalFrame%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")

Parameters:

f - the JInternalFrame to be restored


iconifyFrame

public void iconifyFrame(JInternalFrame f)

Removes the frame from its parent and adds itsdesktopIcon to the parent.

Specified by:

[iconifyFrame](../../javax/swing/DesktopManager.html#iconifyFrame%28javax.swing.JInternalFrame%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")

Parameters:

f - the JInternalFrame to be iconified


deiconifyFrame

public void deiconifyFrame(JInternalFrame f)

Removes the desktopIcon from its parent and adds its frame to the parent.

Specified by:

[deiconifyFrame](../../javax/swing/DesktopManager.html#deiconifyFrame%28javax.swing.JInternalFrame%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")

Parameters:

f - the JInternalFrame to be de-iconified


activateFrame

public void activateFrame(JInternalFrame f)

This will activate f moving it to the front. It will set the current active frame's (if any)IS_SELECTED_PROPERTY to false. There can be only one active frame across all Layers.

Specified by:

[activateFrame](../../javax/swing/DesktopManager.html#activateFrame%28javax.swing.JInternalFrame%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")

Parameters:

f - the JInternalFrame to be activated


deactivateFrame

public void deactivateFrame(JInternalFrame f)

Description copied from interface: [DesktopManager](../../javax/swing/DesktopManager.html#deactivateFrame%28javax.swing.JInternalFrame%29)

Generally, indicate that this frame has lost focus. This is usually called after the JInternalFrame's IS_SELECTED_PROPERTY has been set to false.

Specified by:

[deactivateFrame](../../javax/swing/DesktopManager.html#deactivateFrame%28javax.swing.JInternalFrame%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")


beginDraggingFrame

public void beginDraggingFrame(JComponent f)

Description copied from interface: [DesktopManager](../../javax/swing/DesktopManager.html#beginDraggingFrame%28javax.swing.JComponent%29)

This method is normally called when the user has indicated that they will begin dragging a component around. This method should be called prior to any dragFrame() calls to allow the DesktopManager to prepare any necessary state. Normally f will be a JInternalFrame.

Specified by:

[beginDraggingFrame](../../javax/swing/DesktopManager.html#beginDraggingFrame%28javax.swing.JComponent%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")


dragFrame

public void dragFrame(JComponent f, int newX, int newY)

Moves the visible location of the frame being dragged to the location specified. The means by which this occurs can vary depending on the dragging algorithm being used. The actual logical location of the frame might not change until endDraggingFrame is called.

Specified by:

[dragFrame](../../javax/swing/DesktopManager.html#dragFrame%28javax.swing.JComponent, int, int%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")


endDraggingFrame

public void endDraggingFrame(JComponent f)

Description copied from interface: [DesktopManager](../../javax/swing/DesktopManager.html#endDraggingFrame%28javax.swing.JComponent%29)

This method signals the end of the dragging session. Any state maintained by the DesktopManager can be removed here. Normally f will be a JInternalFrame.

Specified by:

[endDraggingFrame](../../javax/swing/DesktopManager.html#endDraggingFrame%28javax.swing.JComponent%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")


beginResizingFrame

public void beginResizingFrame(JComponent f, int direction)

Description copied from interface: [DesktopManager](../../javax/swing/DesktopManager.html#beginResizingFrame%28javax.swing.JComponent, int%29)

This methods is normally called when the user has indicated that they will begin resizing the frame. This method should be called prior to any resizeFrame() calls to allow the DesktopManager to prepare any necessary state. Normally f will be a JInternalFrame.

Specified by:

[beginResizingFrame](../../javax/swing/DesktopManager.html#beginResizingFrame%28javax.swing.JComponent, int%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")


resizeFrame

public void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)

Calls setBoundsForFrame with the new values.

Specified by:

[resizeFrame](../../javax/swing/DesktopManager.html#resizeFrame%28javax.swing.JComponent, int, int, int, int%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")

Parameters:

f - the component to be resized

newX - the new x-coordinate

newY - the new y-coordinate

newWidth - the new width

newHeight - the new height


endResizingFrame

public void endResizingFrame(JComponent f)

Description copied from interface: [DesktopManager](../../javax/swing/DesktopManager.html#endResizingFrame%28javax.swing.JComponent%29)

This method signals the end of the resize session. Any state maintained by the DesktopManager can be removed here. Normally f will be a JInternalFrame.

Specified by:

[endResizingFrame](../../javax/swing/DesktopManager.html#endResizingFrame%28javax.swing.JComponent%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")


setBoundsForFrame

public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)

This moves the JComponent and repaints the damaged areas.

Specified by:

[setBoundsForFrame](../../javax/swing/DesktopManager.html#setBoundsForFrame%28javax.swing.JComponent, int, int, int, int%29) in interface [DesktopManager](../../javax/swing/DesktopManager.html "interface in javax.swing")


removeIconFor

protected void removeIconFor(JInternalFrame f)

Convenience method to remove the desktopIcon of f is necessary.


getBoundsForIconOf

protected Rectangle getBoundsForIconOf(JInternalFrame f)

The iconifyFrame() code calls this to determine the proper bounds for the desktopIcon.


setPreviousBounds

protected void setPreviousBounds(JInternalFrame f, Rectangle r)

Stores the bounds of the component just before a maximize call.

Parameters:

f - the component about to be resized

r - the normal bounds to be saved away


getPreviousBounds

protected Rectangle getPreviousBounds(JInternalFrame f)

Gets the normal bounds of the component prior to the component being maximized.

Parameters:

f - the JInternalFrame of interest

Returns:

the normal bounds of the component


setWasIcon

protected void setWasIcon(JInternalFrame f, Boolean value)

Sets that the component has been iconized and the bounds of thedesktopIcon are valid.


wasIcon

protected boolean wasIcon(JInternalFrame f)

Returns true if the component has been iconized and the bounds of the desktopIcon are valid, otherwise returns false.

Parameters:

f - the JInternalFrame of interest

Returns:

true if the component has been iconized; otherwise returns false



Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.