blob: 4453c9ffc93a283abccde797972f1d9b892e042b [file] [log] [blame]
Creates a new JSplitPane configured to arrange the child components side-by-side horizontally with no continuous layout , using two buttons for the components . JSplitPane public JSplitPane ( int newOrientation ) Creates a new JSplitPane configured with the specified orientation and no continuous layout . Parameters : newOrientation - JSplitPane . H ORIZONTAL_SPLIT or JSplitPane . V ERTICAL_SPLIT Throws : IllegalArgumentException - if orientation is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT . JSplitPane public JSplitPane ( int newOrientation , boolean newContinuousLayout ) Creates a new JSplitPane with the specified orientation and redrawing style . Parameters : newOrientation - JSplitPane . H ORIZONTAL_SPLIT or JSplitPane . V ERTICAL_SPLIT newContinuousLayout - a boolean , true for the components to redraw continuously as the divider changes position , false to wait until the divider position stops changing to redraw Throws : IllegalArgumentException - if orientation is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT JSplitPane public JSplitPane ( int newOrientation , Component newLeftComponent , Component newRightComponent ) Creates a new JSplitPane with the specified orientation and with the specified components that do not do continuous redrawing . Parameters : newOrientation - JSplitPane . H ORIZONTAL_SPLIT or JSplitPane . V ERTICAL_SPLIT newLeftComponent - the Component that will appear on the left of a horizontally-split pane , or at the top of a vertically-split pane newRightComponent - the Component that will appear on the right of a horizontally-split pane , or at the bottom of a vertically-split pane Throws : IllegalArgumentException - if orientation is not one of : HORIZONTAL_SPLIT or VERTICAL_SPLIT JSplitPane public JSplitPane ( int newOrientation , boolean newContinuousLayout , Component newLeftComponent , Component newRightComponent ) Creates a new JSplitPane with the specified orientation and redrawing style , and with the specified components . Parameters : newOrientation - JSplitPane . H ORIZONTAL_SPLIT or JSplitPane . V ERTICAL_SPLIT newContinuousLayout - a boolean , true for the components to redraw continuously as the divider changes position , false to wait until the divider position stops changing to redraw newLeftComponent - the Component that will appear on the left of a horizontally-split pane , or at the top of a vertically-split pane newRightComponent - the Component that will appear on the right of a horizontally-split pane , or at the bottom of a vertically-split pane Throws : IllegalArgumentException - if orientation is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT Method Detail setUI public void setUI ( SplitPaneUI ui ) Sets the L&F object that renders this component . Parameters : ui - the SplitPaneUI L&F object See Also : UIDefaults . g etUI(javax . s wing . J Component ) getUI public SplitPaneUI getUI ( ) Returns the SplitPaneUI that is providing the current look and feel . Returns : the SplitPaneUI object that renders this component updateUI public void updateUI ( ) Notification from the UIManager that the L&F has changed . Replaces the current UI object with the latest version from the UIManager . Overrides : updateUI in class JComponent See Also : JComponent . u pdateUI( ) getUIClassID public String getUIClassID ( ) Returns the name of the L&F class that renders this component . Overrides : getUIClassID in class JComponent Returns : the string " SplitPaneUI " See Also : JComponent . g etUIClassID( ) , UIDefaults . g etUI(javax . s wing . J Component ) setDividerSize public void setDividerSize ( int newSize ) Sets the size of the divider . Parameters : newSize - an integer giving the size of the divider in pixels getDividerSize public int getDividerSize ( ) Returns the size of the divider . Returns : an integer giving the size of the divider in pixels setLeftComponent public void setLeftComponent ( Component comp ) Sets the component to the left ( or above ) the divider . Parameters : comp - the Component to display in that position getLeftComponent public Component getLeftComponent ( ) Returns the component to the left ( or above ) the divider . Returns : the Component displayed in that position setTopComponent public void setTopComponent ( Component comp ) Sets the component above , or to the left of the divider . Parameters : comp - the Component to display in that position getTopComponent public Component getTopComponent ( ) Returns the component above , or to the left of the divider . Returns : the Component displayed in that position setRightComponent public void setRightComponent ( Component comp ) Sets the component to the right ( or below ) the divider . Parameters : comp - the Component to display in that position getRightComponent public Component getRightComponent ( ) Returns the component to the right ( or below ) the divider . Returns : the Component displayed in that position setBottomComponent public void setBottomComponent ( Component comp ) Sets the component below , or to the right of the divider . Parameters : comp - the Component to display in that position getBottomComponent public Component getBottomComponent ( ) Returns the component below , or to the right of the divider . Returns : the Component displayed in that position setOneTouchExpandable public void setOneTouchExpandable ( boolean newValue ) Sets the value of the oneTouchExpandable property , which must be true for the JSplitPane to provide a UI widget on the divider to quickly expand/collapse the divider . The default value of this property is false . Some look and feels might not support one-touch expanding ; they will ignore this property . Parameters : newValue - true to specify that the split pane should provide a collapse/expand widget See Also : isOneTouchExpandable( ) isOneTouchExpandable public boolean isOneTouchExpandable ( ) Gets the oneTouchExpandable property . Returns : the value of the oneTouchExpandable property See Also : setOneTouchExpandable(boolean ) setLastDividerLocation public void setLastDividerLocation ( int newLastLocation ) Sets the last location the divider was at to newLastLocation . Parameters : newLastLocation - an integer specifying the last divider location in pixels , from the left ( or upper ) edge of the pane to the left ( or upper ) edge of the divider getLastDividerLocation public int getLastDividerLocation ( ) Returns the last location the divider was at . Returns : an integer specifying the last divider location as a count of pixels from the left ( or upper ) edge of the pane to the left ( or upper ) edge of the divider setOrientation public void setOrientation ( int orientation ) Sets the orientation , or how the splitter is divided . The options are : JSplitPane . V ERTICAL_SPLIT ( above/below orientation of components ) JSplitPane . H ORIZONTAL_SPLIT ( left/right orientation of components ) Parameters : orientation - an integer specifying the orientation Throws : IllegalArgumentException - if orientation is not one of : HORIZONTAL_SPLIT or VERTICAL_SPLIT . getOrientation public int getOrientation ( ) Returns the orientation . Returns : an integer giving the orientation See Also : setOrientation(int ) setContinuousLayout public void setContinuousLayout ( boolean newContinuousLayout ) Sets the value of the continuousLayout property , which must be true for the child components to be continuously redisplayed and laid out during user intervention . The default value of this property is false . Some look and feels might not support continuous layout ; they will ignore this property . Parameters : newContinuousLayout - true if the components should continuously be redrawn as the divider changes position See Also : isContinuousLayout( ) isContinuousLayout public boolean isContinuousLayout ( ) Gets the continuousLayout property . Returns : the value of the continuousLayout property See Also : setContinuousLayout(boolean ) setResizeWeight public void setResizeWeight ( double value ) Specifies how to distribute extra space when the size of the split pane changes . A value of 0 , the default , indicates the right/bottom component gets all the extra space ( the left/top component acts fixed ) , where as a value of 1 specifies the left/top component gets all the extra space ( the right/bottom component acts fixed ) . Specifically , the left/top component gets ( weight * diff ) extra space and the right/bottom component gets ( 1 - weight ) * diff extra space . Parameters : value - as described above Throws : IllegalArgumentException - if value is 1 Since : 1.3 getResizeWeight public double getResizeWeight ( ) Returns the number that determines how extra space is distributed . Returns : how extra space is to be distributed on a resize of the split pane Since : 1.3 resetToPreferredSizes public void resetToPreferredSizes ( ) Lays out the JSplitPane layout based on the preferred size of the children components . This will likely result in changing the divider location . setDividerLocation public void setDividerLocation ( double proportionalLocation ) Sets the divider location as a percentage of the JSplitPane ' s size . This method is implemented in terms of setDividerLocation(int ) . This method immediately changes the size of the split pane based on its current size . If the split pane is not correctly realized and on screen , this method will have no effect ( new divider location will become ( current size * proportionalLocation ) which is 0 ) . Parameters : proportionalLocation - a double-precision floating point value that specifies a percentage , from zero ( top/left ) to 1.0 ( bottom/right ) Throws : IllegalArgumentException - if the specified location is 1.0 setDividerLocation public void setDividerLocation ( int location ) Sets the location of the divider . This is passed off to the look and feel implementation , and then listeners are notified . A value less than 0 implies the divider should be reset to a value that attempts to honor the preferred size of the left/top component . After notifying the listeners , the last divider location is updated , via setLastDividerLocation . Parameters : location - an int specifying a UI-specific value ( typically a pixel count ) getDividerLocation public int getDividerLocation ( ) Returns the last value passed to setDividerLocation . The value returned from this method may differ from the actual divider location ( if setDividerLocation was passed a value bigger than the curent size ) . Returns : an integer specifying the location of the divider getMinimumDividerLocation public int getMinimumDividerLocation ( ) Returns the minimum location of the divider from the look and feel implementation . Returns : an integer specifying a UI-specific value for the minimum location ( typically a pixel count ) ; or -1 if the UI is null getMaximumDividerLocation public int getMaximumDividerLocation ( ) Returns the maximum location of the divider from the look and feel implementation . Returns : an integer specifying a UI-specific value for the maximum location ( typically a pixel count ) ; or -1 if the UI is null remove public void remove ( Component component ) Removes the child component , component from the pane . Resets the leftComponent or rightComponent instance variable , as necessary . Overrides : remove in class Container Parameters : component - the Component to remove See Also : Container . a dd(java . a wt . C omponent ) remove public void remove ( int index ) Removes the Component at the specified index . Updates the leftComponent and rightComponent instance variables as necessary , and then messages super . Overrides : remove in class Container Parameters : index - an integer specifying the component to remove , where 1 specifies the left/top component and 2 specifies the bottom/right component See Also : Container . a dd(java . a wt . C omponent ) removeAll public void removeAll ( ) Removes all the child components from the split pane . Resets the leftComonent and rightComponent instance variables . Overrides : removeAll in class Container See Also : Container . a dd(java . a wt . C omponent ) , Container . r emove(int ) isValidateRoot public boolean isValidateRoot ( ) Returns true , so that calls to revalidate on any descendant of this JSplitPane will cause a request to be queued that will validate the JSplitPane and all its descendants . Overrides : isValidateRoot in class JComponent Returns : true See Also : JComponent . r evalidate( ) addImpl protected void addImpl ( Component comp , Object constraints , int index ) Adds the specified component to this split pane . If constraints identifies the left/top or right/bottom child component , and a component with that identifier was previously added , it will be removed and then comp will be added in its place . If constraints is not one of the known identifiers the layout manager may throw an IllegalArgumentException . The possible constraints objects ( Strings ) are : JSplitPane . T OP JSplitPane . L EFT JSplitPane . B OTTOM JSplitPane . R IGHT If the constraints object is null , the component is added in the first available position ( left/top if open , else right/bottom ) . Overrides : addImpl in class Container Parameters : comp - the component to add constraints - an Object specifying the layout constraints ( position ) for this component index - an integer specifying the index in the container 's list . Throws : IllegalArgumentException - if the constraints object does not match an existing component See Also : Container . a ddImpl(Component , Object , int ) paintChildren protected void paintChildren ( Graphics g ) Subclassed to message the UI with finishedPaintingChildren after super has been messaged , as well as painting the border . Overrides : paintChildren in class JComponent Parameters : g - the Graphics context within which to paint See Also : JComponent . p aint(java . a wt . G raphics ) , Container . p aint(java . a wt . G raphics ) paramString protected String paramString ( ) Returns a string representation of this JSplitPane . This method is intended to be used only for debugging purposes , and the content and format of the returned string may vary between implementations . The returned string may be empty but may not be null . Overrides : paramString in class JComponent Returns : a string representation of this JSplitPane . getAccessibleContext public AccessibleContext getAccessibleContext ( ) Gets the AccessibleContext associated with this JSplitPane . For split panes , the AccessibleContext takes the form of an AccessibleJSplitPane . A new AccessibleJSplitPane instance is created if necessary .