The DesktopManager Interface

This interface is responsible for much of the management of internal frames contained by JDesktopPanes. It allows an L&F to define exactly how it wants to manage things such as frame activation, movement, and iconification. Most of the methods in InternalFrameUI implementations should delegate to a DesktopManager object. As described earlier, DesktopManagers are contained by JDesktopPane objects and are intended to be set by the L&F. You can also create your own variations on the supplied implementations to provide custom behavior, as shown in the example that concludes this chapter.

Methods

The majority of the methods in this interface act on a given JInternalFrame. However, those methods that could be applied to other types of components do not restrict the parameter unnecessarily (they accept any JComponent), despite the fact that they are typically used only with JInternalFrames. If you implement your own DesktopManager or other L&F classes, you may find a need for this flexibility.

public abstract void activateFrame( JInternalFrame f )

Called to indicate that the specified frame should become active (is gaining focus).

public abstract void beginDraggingFrame( JComponent f )

Called to indicate that the specified frame is now being dragged. The given component is normally a JInternalFrame.

public abstract void beginResizingFrame( JComponent f, int direction)

Called to indicate that the specified frame will be resized. The direction comes from SwingConstants ...

Get Java Swing, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.