JavaTM 2 Platform
Std. Ed. v1.3.1

javax.swing
Class DefaultDesktopManager

java.lang.Object
  |
  +--javax.swing.DefaultDesktopManager
All Implemented Interfaces:
DesktopManager, Serializable

public class DefaultDesktopManager
extends Object
implements DesktopManager, Serializable

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

See Also:
JDesktopPane, JInternalFrame, Serialized Form

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(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 the desktopIcon, 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(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)
           
 void iconifyFrame(JInternalFrame f)
          Removes the frame from its parent and adds its desktopIcon 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)
          Convience method to remove the desktopIcon of f is necessary.
 void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)
          Calls setBoundsForFrame() with the new values.
 void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)
          This moves the JComponent and repaints the damaged areas.
protected  void setPreviousBounds(JInternalFrame f, Rectangle r)
          Stores the bounds of the component just before a maximize call.
protected  void setWasIcon(JInternalFrame f, Boolean value)
          Sets that the component has been iconized and the bounds of the desktopIcon are valid.
protected  boolean wasIcon(JInternalFrame f)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 in interface DesktopManager

closeFrame

public void closeFrame(JInternalFrame f)
Removes the frame, and if necessary the desktopIcon, from its parent.
Specified by:
closeFrame in interface DesktopManager

maximizeFrame

public void maximizeFrame(JInternalFrame f)
Resizes the frame to fill its parents bounds.
Specified by:
maximizeFrame in interface DesktopManager

minimizeFrame

public void minimizeFrame(JInternalFrame f)
Restores the frame back to its size and position prior to a maximizeFrame() call.
Specified by:
minimizeFrame in interface DesktopManager

iconifyFrame

public void iconifyFrame(JInternalFrame f)
Removes the frame from its parent and adds its desktopIcon to the parent.
Specified by:
iconifyFrame in interface DesktopManager

deiconifyFrame

public void deiconifyFrame(JInternalFrame f)
Removes the desktopIcon from its parent and adds its frame to the parent.
Specified by:
deiconifyFrame in interface DesktopManager

activateFrame

public void activateFrame(JInternalFrame f)
This will activate f moving it to the front. It will set the current active frame (if any) IS_SELECTED_PROPERTY to false. There can be only one active frame across all Layers.
Specified by:
activateFrame in interface DesktopManager

deactivateFrame

public void deactivateFrame(JInternalFrame f)
Description copied from interface: DesktopManager
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 in interface DesktopManager

beginDraggingFrame

public void beginDraggingFrame(JComponent f)
Description copied from interface: DesktopManager
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 in interface DesktopManager

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 in interface DesktopManager

endDraggingFrame

public void endDraggingFrame(JComponent f)
Description copied from interface: DesktopManager
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 in interface DesktopManager

beginResizingFrame

public void beginResizingFrame(JComponent f,
                               int direction)
Description copied from interface: DesktopManager
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 in interface DesktopManager

resizeFrame

public void resizeFrame(JComponent f,
                        int newX,
                        int newY,
                        int newWidth,
                        int newHeight)
Calls setBoundsForFrame() with the new values.
Specified by:
resizeFrame in interface DesktopManager

endResizingFrame

public void endResizingFrame(JComponent f)
Description copied from interface: DesktopManager
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 in interface DesktopManager

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 in interface DesktopManager

removeIconFor

protected void removeIconFor(JInternalFrame f)
Convience 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.

getPreviousBounds

protected Rectangle getPreviousBounds(JInternalFrame f)

setWasIcon

protected void setWasIcon(JInternalFrame f,
                          Boolean value)
Sets that the component has been iconized and the bounds of the desktopIcon are valid.

wasIcon

protected boolean wasIcon(JInternalFrame f)

JavaTM 2 Platform
Std. Ed. v1.3.1

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.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.