Class JDesktopPane

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

    public class JDesktopPane
    extends javax.swing.JDesktopPane
    This class extends a JDesktopPane and provide organization methods for the internal frames.
    Since:
    1.0.1
    Author:
    Julien Seinturier - (c) 2009 - JOrigin project - http:/www.jorigin.org
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JDesktopPane

        javax.swing.JDesktopPane.AccessibleJDesktopPane
      • Nested classes/interfaces inherited from class javax.swing.JLayeredPane

        javax.swing.JLayeredPane.AccessibleJLayeredPane
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CASCADE
      This flag represents a cascade organization for the internal frames.
      static int FIT_CENTER
      Added component are centered
      static int FIT_CENTER_DELTA
      Added component are centered then switched in x and y by a delta.
      static int FIT_CENTER_RESIZE
      Added component are centered and resized to fit the default.
      static int FIT_CENTER_RESIZE_DELTA
      Added component are centered, resized and switched by a delta.
      static int FIT_NONE
      No fit is applied to the added components
      static int MOSAIC
      This flag represents a mosaic organization for the internal frames.
      static int NONE
      This flag represent a no organization method for the internal frames.
      • Fields inherited from class javax.swing.JDesktopPane

        LIVE_DRAG_MODE, OUTLINE_DRAG_MODE
      • Fields inherited from class javax.swing.JLayeredPane

        DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER
      • Fields inherited from class javax.swing.JComponent

        listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor Description
      JDesktopPane()
      Create a new default desktop pane.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addInternalFrame​(java.lang.String title, java.awt.Container container)
      Add a container as internal frame in the current desktop.
      void addInternalFrame​(java.lang.String title, java.awt.Container container, boolean fit)
      Add a container as internal frame in the current desktop.
      void addInternalFrame​(javax.swing.JInternalFrame frame, boolean fit)
      Add an internal frame to the desktop.
      void cascade()
      Reorganize the frames of the desktop by using cascading
      void fit​(javax.swing.JInternalFrame frame)
      Fit the given frame to take all the available space within the desktop pane.
      double getFitDeltaMax()
      Get the fit delta maximum value.
      int getFitMethod()
      Get the fit method used to initialize space occupation of new components.
      double getFrameDimensionRatio()
      Get the frame dimension ratio for internal frame.
      int getOrganizeMethod()
      Get the organization method used by the desktop to organize components.
      void mosaic()
      Reorganize the frames of the desktop by using mosaic
      void organize()
      Organize the Internal frames following the default method
      void organize​(int method)
      Organize the Internal frames following the method given in parameter.
      void setFitDeltaMax​(double delta)
      Set the fit delta maximum value.
      void setFitMethod​(int fitMethod)
      Set the fit method used to initialize space occupation of new components.
      void setFrameDimensionRatio​(double ratio)
      Set the frame dimension ratio for internal frame.
      void setOrganizeMethod​(int method)
      Set the organization method used by the desktop to organize components.
      • Methods inherited from class javax.swing.JDesktopPane

        addImpl, getAccessibleContext, getAllFrames, getAllFramesInLayer, getDesktopManager, getDragMode, getSelectedFrame, getUI, getUIClassID, paramString, remove, remove, removeAll, selectFrame, setComponentZOrder, setDesktopManager, setDragMode, setSelectedFrame, setUI, updateUI
      • Methods inherited from class javax.swing.JLayeredPane

        getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, putLayer, setLayer, setLayer, setPosition
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • CASCADE

        public static final int CASCADE
        This flag represents a cascade organization for the internal frames.
        See Also:
        NONE, MOSAIC, Constant Field Values
      • FIT_NONE

        public static final int FIT_NONE
        No fit is applied to the added components
        See Also:
        Constant Field Values
      • FIT_CENTER

        public static final int FIT_CENTER
        Added component are centered
        See Also:
        Constant Field Values
      • FIT_CENTER_RESIZE

        public static final int FIT_CENTER_RESIZE
        Added component are centered and resized to fit the default. The fit ratio is given by method getFrameDimensionRatio()
        See Also:
        Constant Field Values
      • FIT_CENTER_DELTA

        public static final int FIT_CENTER_DELTA
        Added component are centered then switched in x and y by a delta. The delta is available with methods setFitDeltaMax(double delta) and getFitDeltaMax
        See Also:
        Constant Field Values
      • FIT_CENTER_RESIZE_DELTA

        public static final int FIT_CENTER_RESIZE_DELTA
        Added component are centered, resized and switched by a delta. The fit ratio is given by method getFrameDimensionRatio(). The delta is available with methods setFitDeltaMax(double delta) and getFitDeltaMax
        See Also:
        Constant Field Values
    • Constructor Detail

      • JDesktopPane

        public JDesktopPane()
        Create a new default desktop pane.
    • Method Detail

      • setOrganizeMethod

        public void setOrganizeMethod​(int method)
        Set the organization method used by the desktop to organize components.
        Parameters:
        method - the method to use, can be CASCADE, MOSAIC or NONE.
      • getOrganizeMethod

        public int getOrganizeMethod()
        Get the organization method used by the desktop to organize components.
        Returns:
        the organization method.
      • setFrameDimensionRatio

        public void setFrameDimensionRatio​(double ratio)
        Set the frame dimension ratio for internal frame. All added internal frame will be redimensionned to fit the ratio of descktop dimension.
        Parameters:
        ratio - the ratio of desktop dimension.
      • getFrameDimensionRatio

        public double getFrameDimensionRatio()
        Get the frame dimension ratio for internal frame. All added internal frame will be redimensionned to fit the ratio of descktop dimension.
        Returns:
        ratio the ratio of desktop dimension.
      • setFitMethod

        public void setFitMethod​(int fitMethod)
        Set the fit method used to initialize space occupation of new components.
        Parameters:
        fitMethod - the fit method to use (FIT_CENTER, FIT_CENTER_RESIZE, ...)
      • getFitMethod

        public int getFitMethod()
        Get the fit method used to initialize space occupation of new components.
        Returns:
        the fit method to use (FIT_CENTER, FIT_CENTER_RESIZE, ...)
      • setFitDeltaMax

        public void setFitDeltaMax​(double delta)
        Set the fit delta maximum value. The delta is used when an organization with random delta is processed.
        Parameters:
        delta - the max delta value.
      • getFitDeltaMax

        public double getFitDeltaMax()
        Get the fit delta maximum value. The delta is used when an organization with random delta is processed.
        Returns:
        the max delta value.
      • organize

        public void organize()
        Organize the Internal frames following the default method
      • organize

        public void organize​(int method)
        Organize the Internal frames following the method given in parameter. MOSAIC
        Parameters:
        method - the method to use (can be MOSAIC or CASCADE)
      • cascade

        public void cascade()
        Reorganize the frames of the desktop by using cascading
      • mosaic

        public void mosaic()
        Reorganize the frames of the desktop by using mosaic
      • fit

        public void fit​(javax.swing.JInternalFrame frame)
        Fit the given frame to take all the available space within the desktop pane.
        Parameters:
        frame - the frame to fit.
      • addInternalFrame

        public void addInternalFrame​(java.lang.String title,
                                     java.awt.Container container,
                                     boolean fit)
        Add a container as internal frame in the current desktop.
        Parameters:
        title - String the title of the internal frame
        container - Container the conainer to add
        fit - If this boolean is true, the frame is redimensioned and relocated by the desktop to fit the default placement methods. If false is given, the internal frame is not resized and relocated.
      • addInternalFrame

        public void addInternalFrame​(java.lang.String title,
                                     java.awt.Container container)
        Add a container as internal frame in the current desktop.
        Parameters:
        title - String the title of the internal frame
        container - Container the conainer to add
      • addInternalFrame

        public void addInternalFrame​(javax.swing.JInternalFrame frame,
                                     boolean fit)
        Add an internal frame to the desktop.
        Parameters:
        frame - the frame to add.
        fit - is the frame has to fit within the desktop pane.