org.openide.awt
Class SplittedPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--org.openide.awt.SplittedPanel
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class SplittedPanel
extends JComponent
implements Accessible

The SplittedPanel widget is a Panel that can contain one or two components and place them side-by-side vertically or horizontally with a splitter in the middle. User can move the split point by dragging the splitter with mouse. The two components are accessed by add/remove methods with constraints value ADD_SPLITTER, ADD_FIRST, ADD_SECOND, .... The split position could be either absolute or proportional (according to the "Absolute" property setting) - in thwe absolute mode the split point remains same when resizing (i.e. the left/top component keeps its size and only the right/bottom component resizes), while in the proportional mode the splitPosition is a percentage of the width/height assigned to the left/top component.

PropertyProperty TypeDescription
SplitType int The type of the splitting - HORIZONTAL, VERTICAL or NONE
SplitPosition int The position of the split point - either absolute position or number of percents according to the "Absolute" property settings, could be one of FIRST_PREFERRED or SECOND_PREFERRED, which means that the split point should be placed so that the first(left/top) resp. second (bottom/rignt) is sized according to its preferredSize (in this case the Absolute property setting is ignored)
SplitterType int The type of the component that renders the splitter - DEFAULT_SPLITTER, RAISED_SPLITTER, EMPTY_SPLITTER.
SplitterComponent Component The component that renders the splitter. A custom component can be provided in addition to EMPTY_SPLITTER and RAISED-SPLITTER using this method.
SplitAbsolute boolean if true then the meaning of the SplitPosition is absolute points, otherwise the SplitPosition is a number of percents
SplitDragable boolean if true then the split point can be dragged using a mouse, otherwise the SplitPosition is fixed
SplitTypeChangeEnabled boolean if true then the split type can be changed via popup menu commands
SwapPanesEnabled boolean if true then the panes can be swapped via popup menu command

See Also:
Serialized Form

Inner Class Summary
static class SplittedPanel.EmptySplitter
          The EmptySplitter is an empty splitter component with specified width.
static class SplittedPanel.SplitChangeEvent
          An event that describes a split point change
static interface SplittedPanel.SplitChangeListener
          A listener interface for tracking split point changes
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
Component.AccessibleAWTComponent
 
Field Summary
static Object ADD_BOTTOM
          constraints constant for adding a component to the bottom(right) pane (an alias for the ADD_SECOND constant)
static Object ADD_FIRST
          constraints constant for adding a component to the first (left/top) pane
static Object ADD_LEFT
          constraints constant for adding a component to the left(top) pane (an alias for the ADD_FIRST constant)
static Object ADD_RIGHT
          constraints constant for adding a component to the right(bottom) pane (an alias for the ADD_SECOND constant)
static Object ADD_SECOND
          constraints constant for adding a component to the second (right/bottom) pane
static Object ADD_SPLITTER
          constraints constant for adding a splitter
static Object ADD_TOP
          constraints constant for adding a component to the top(left) pane (an alias for the ADD_FIRST constant)
static int DEFAULT_SPLITTER
          constant for splitter component types - default splitter (raised)
static int EMPTY_SPLITTER
          constant for splitter component types - empty splitter
static int FIRST_PREFERRED
          constant for moving the split point so that the first (left/top) component is sized according to its preferredSize
static int HORIZONTAL
          constant for horizontal split
static int NONE
          constant for no split - only the first (left/top) component will be shown
static int RAISED_SPLITTER
          constant for splitter component types - raised splitter
static int SECOND_PREFERRED
          constant for moving the split point so that the second (right/bottom) component is sized according to its preferredSize
static int VERTICAL
          constant for vertical split
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
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
SplittedPanel()
          Constructs a new empty SplittedPanel with no spliting.
 
Method Summary
 void addSplitChangeListener(SplittedPanel.SplitChangeListener l)
          Adds specified listener to the current set of SplitChangeListeners
protected  void computeSizesAfterFlip()
          Computes component sizes after performing the flip, it means splitTypeChange
protected  void fireSplitChange(int oldValue, int newValue)
          Fires the SplitChange event
 AccessibleContext getAccessibleContext()
           
 boolean getKeepFirstSame()
          Getter method for the KeepFirstSame property.
 boolean getKeepSecondSame()
          Getter method for the KeepSecondSame property.
 boolean getPanesSwapped()
           
 int getSplitPosition()
          Getter method for the SplitPosition property.
 Component getSplitterComponent()
          Getter method for the SplitterComponent property.
 int getSplitterType()
          Getter method for the SplitterType property.
 int getSplitType()
          Getter method for the SplitType property.
 boolean isContinuousLayout()
          Getter method for the ContinuousLayout property.
 boolean isSplitAbsolute()
          Getter method for the SplitAbsolute property.
 boolean isSplitDragable()
          Getter method for the SplitDragable property.
 boolean isSplitTypeChangeEnabled()
          Getter method for the SplitTypeChangeEnabled property.
 boolean isSwapPanesEnabled()
          Getter method for the SwapPanesEnabled property.
 void removeSplitChangeListener(SplittedPanel.SplitChangeListener l)
          Removes specified listener from the current set of SplitChangeListeners
 void setContinuousLayout(boolean value)
          Setter method for the ContinuousLayout property.
 void setKeepFirstSame(boolean value)
          Setter method for the KeepFirstSame property.
 void setKeepSecondSame(boolean value)
          Setter method for the KeepSecondSame property.
 void setSplitAbsolute(boolean value)
          Setter method for the SplitAbsolute property.
 void setSplitDragable(boolean value)
          Setter method for the Dragable property.
 void setSplitPosition(int value)
          Setter method for the SplitPosition property.
 void setSplitterComponent(Component comp)
          Setter method for the SplitterComponent property.
protected  void setSplitterCursor()
          Updates the splitter's cursor according to the current SplittedPanel settings.
 void setSplitterType(int type)
          Setter method for the SplitterType property.
 void setSplitType(int value)
          Setter method for the SplitType property.
 void setSplitTypeChangeEnabled(boolean value)
          Setter method for the SplitTypeChangeEnabled property.
 void setSwapPanesEnabled(boolean value)
          Setter method for the SwapPanesEnabled property.
 void swapPanes()
          Swaps the panes.
protected  void updatePopupMenu()
          Updates the splitter's popup menu.
protected  void updateSplitting()
          Updates the visual state and layout when the split state changes.
 void updateUI()
          Updates splitting, too.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
constant for no split - only the first (left/top) component will be shown

VERTICAL

public static final int VERTICAL
constant for vertical split

HORIZONTAL

public static final int HORIZONTAL
constant for horizontal split

ADD_SPLITTER

public static final Object ADD_SPLITTER
constraints constant for adding a splitter

ADD_FIRST

public static final Object ADD_FIRST
constraints constant for adding a component to the first (left/top) pane

ADD_SECOND

public static final Object ADD_SECOND
constraints constant for adding a component to the second (right/bottom) pane

ADD_LEFT

public static final Object ADD_LEFT
constraints constant for adding a component to the left(top) pane (an alias for the ADD_FIRST constant)

ADD_TOP

public static final Object ADD_TOP
constraints constant for adding a component to the top(left) pane (an alias for the ADD_FIRST constant)

ADD_RIGHT

public static final Object ADD_RIGHT
constraints constant for adding a component to the right(bottom) pane (an alias for the ADD_SECOND constant)

ADD_BOTTOM

public static final Object ADD_BOTTOM
constraints constant for adding a component to the bottom(right) pane (an alias for the ADD_SECOND constant)

FIRST_PREFERRED

public static final int FIRST_PREFERRED
constant for moving the split point so that the first (left/top) component is sized according to its preferredSize

SECOND_PREFERRED

public static final int SECOND_PREFERRED
constant for moving the split point so that the second (right/bottom) component is sized according to its preferredSize

RAISED_SPLITTER

public static final int RAISED_SPLITTER
constant for splitter component types - raised splitter

EMPTY_SPLITTER

public static final int EMPTY_SPLITTER
constant for splitter component types - empty splitter

DEFAULT_SPLITTER

public static final int DEFAULT_SPLITTER
constant for splitter component types - default splitter (raised)
Constructor Detail

SplittedPanel

public SplittedPanel()
Constructs a new empty SplittedPanel with no spliting.
Method Detail

updateUI

public void updateUI()
Updates splitting, too.
Overrides:
updateUI in class JComponent

updateSplitting

protected void updateSplitting()
Updates the visual state and layout when the split state changes.

computeSizesAfterFlip

protected void computeSizesAfterFlip()
Computes component sizes after performing the flip, it means splitTypeChange

setSplitterCursor

protected void setSplitterCursor()
Updates the splitter's cursor according to the current SplittedPanel settings.

updatePopupMenu

protected void updatePopupMenu()
Updates the splitter's popup menu.

swapPanes

public void swapPanes()
Swaps the panes.

getPanesSwapped

public boolean getPanesSwapped()
Returns:
true if the panes are swapped, false otherwise

getSplitType

public int getSplitType()
Getter method for the SplitType property.
Returns:
Current SplitType value.

setSplitType

public void setSplitType(int value)
Setter method for the SplitType property.
Parameters:
value - New SplitType value.

getSplitPosition

public int getSplitPosition()
Getter method for the SplitPosition property.
Returns:
Current SplitPosition value.

setSplitPosition

public void setSplitPosition(int value)
Setter method for the SplitPosition property.
Parameters:
value - New SplitPosition value.

getSplitterType

public int getSplitterType()
Getter method for the SplitterType property.
Returns:
Current SplitterType value.
See Also:
EMPTY_SPLITTER, RAISED_SPLITTER, DEFAULT_SPLITTER

setSplitterType

public void setSplitterType(int type)
Setter method for the SplitterType property.
Parameters:
value - New SplitterType value.
See Also:
EMPTY_SPLITTER, RAISED_SPLITTER, DEFAULT_SPLITTER

getSplitterComponent

public Component getSplitterComponent()
Getter method for the SplitterComponent property.
Returns:
Current SplitterComponent value.
See Also:
getSplitterType()

setSplitterComponent

public void setSplitterComponent(Component comp)
Setter method for the SplitterComponent property.
Parameters:
comp - New SplitterComponent value.
See Also:
setSplitterType(int)

isSplitAbsolute

public boolean isSplitAbsolute()
Getter method for the SplitAbsolute property.
Returns:
Current SplitAbsolute value.

setSplitAbsolute

public void setSplitAbsolute(boolean value)
Setter method for the SplitAbsolute property.
Parameters:
value - New SplitAbsolute value.

isSplitDragable

public boolean isSplitDragable()
Getter method for the SplitDragable property.
Returns:
Current SplitDragable value.

setSplitDragable

public void setSplitDragable(boolean value)
Setter method for the Dragable property.
Parameters:
value - New Dragable value.

isContinuousLayout

public boolean isContinuousLayout()
Getter method for the ContinuousLayout property.
Returns:
Current ContinuousLayout value.

setContinuousLayout

public void setContinuousLayout(boolean value)
Setter method for the ContinuousLayout property.
Parameters:
value - New ContinuousLayout value.

getKeepFirstSame

public boolean getKeepFirstSame()
Getter method for the KeepFirstSame property.
Returns:
Current KeepFirstSame value.

setKeepFirstSame

public void setKeepFirstSame(boolean value)
Setter method for the KeepFirstSame property.
Parameters:
value - New KeepFirstSame value.

getKeepSecondSame

public boolean getKeepSecondSame()
Getter method for the KeepSecondSame property.
Returns:
Current KeepSecondSame value.

setKeepSecondSame

public void setKeepSecondSame(boolean value)
Setter method for the KeepSecondSame property.
Parameters:
value - New KeepSecondSame value.

isSplitTypeChangeEnabled

public boolean isSplitTypeChangeEnabled()
Getter method for the SplitTypeChangeEnabled property.
Returns:
Current SplitTypeChangeEnabled value.

setSplitTypeChangeEnabled

public void setSplitTypeChangeEnabled(boolean value)
Setter method for the SplitTypeChangeEnabled property.
Parameters:
value - New SplitTypeChangeEnabled value.

isSwapPanesEnabled

public boolean isSwapPanesEnabled()
Getter method for the SwapPanesEnabled property.
Returns:
Current SwapPanesEnabled value.

setSwapPanesEnabled

public void setSwapPanesEnabled(boolean value)
Setter method for the SwapPanesEnabled property.
Parameters:
value - New SwapPanesEnabled value.

addSplitChangeListener

public void addSplitChangeListener(SplittedPanel.SplitChangeListener l)
Adds specified listener to the current set of SplitChangeListeners

removeSplitChangeListener

public void removeSplitChangeListener(SplittedPanel.SplitChangeListener l)
Removes specified listener from the current set of SplitChangeListeners

fireSplitChange

protected void fireSplitChange(int oldValue,
                               int newValue)
Fires the SplitChange event

getAccessibleContext

public AccessibleContext getAccessibleContext()
Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class JComponent


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.