javax.swing.JSplitPane#getLeftComponent ( )源码实例Demo

下面列出了javax.swing.JSplitPane#getLeftComponent ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: gate-core   文件: DocumentEditor.java
/**
 * TODO: to remove? doesn't seems to be used anywhere.
 */
protected void updateSplitLocation(JSplitPane split, int foo) {
  Component left = split.getLeftComponent();
  Component right = split.getRightComponent();
  if(left == null) {
    split.setDividerLocation(0);
    return;
  }
  if(right == null) {
    split.setDividerLocation(1);
    return;
  }
  Dimension leftPS = left.getPreferredSize();
  Dimension rightPS = right.getPreferredSize();
  double location =
      split.getOrientation() == JSplitPane.HORIZONTAL_SPLIT
          ? (double)leftPS.width / (leftPS.width + rightPS.width)
          : (double)leftPS.height / (leftPS.height + rightPS.height);
  split.setDividerLocation(location);
}
 
源代码2 项目: stendhal   文件: StyledSplitPaneUI.java
@Override
public int getMaximumDividerLocation(JSplitPane pane) {
	int rightMax = super.getMaximumDividerLocation(pane);
	Component first = pane.getLeftComponent();
	if ((first != null) && first.isVisible()) {
		Dimension maxSize = first.getMaximumSize();
		Insets insets = pane.getInsets();
		if (pane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
			rightMax = Math.min(rightMax, maxSize.width + insets.left);
		} else {
			rightMax = Math.min(rightMax, maxSize.height + insets.top);
		}
		// Sanity check. Must be in this method, not in
		// getMinimumDividerLocation() (see below)
		rightMax = Math.max(rightMax, getMinimumDividerLocation(pane));
	}

	return rightMax;
}
 
源代码3 项目: netbeans   文件: JSplitPaneSupport.java
/** Removes a real component from a real container.
    * @param container instance of a real container
    * @param containerDelegate effective container delegate of the container
    * @param component component to be removed
    * @return whether it was possible to remove the component (some containers
    *         may not support removing individual components reasonably)
    */
   @Override
   public boolean removeComponentFromContainer(Container container,
                                               Container containerDelegate,
                                               Component component)
   {
if( !(containerDelegate instanceof JSplitPane) ) {
    return false; // should not happen
}	

JSplitPane splitPane = (JSplitPane) containerDelegate;

if( component == splitPane.getLeftComponent() ) { 
    if( super.removeComponentFromContainer(container, containerDelegate, component) ) {
	JButton left = (JButton) splitPane.getClientProperty(LEFT_TOP_BUTTON);
	if( left != null ) {
	    // fall back to the default swing setting
	    splitPane.setLeftComponent(left);
	    splitPane.putClientProperty(LEFT_TOP_BUTTON, null);
	}	
	return true;
    }
} else if ( component == splitPane.getRightComponent() ) {    
    if( super.removeComponentFromContainer(container, containerDelegate, component) ) {
	JButton right = (JButton) splitPane.getClientProperty(RIGHT_BOTTOM_BUTTON);
	if( right != null ) {
	    // fall back to the default swing setting		    
	    splitPane.setRightComponent(right);		    
	    splitPane.putClientProperty(RIGHT_BOTTOM_BUTTON, null);
	}	
	return true;
    }
}

       return super.removeComponentFromContainer(container, containerDelegate, component);
   }
 
源代码4 项目: netbeans   文件: JCompoundSplitPane.java
private Component getFirstComponent(JSplitPane splitPane) {
    if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
        return splitPane.getLeftComponent();
    } else {
        return splitPane.getTopComponent();
    }
}
 
源代码5 项目: netbeans   文件: ResultWindow.java
public @Override boolean requestFocusInWindow() {
    JSplitPane view = getCurrentResultView();
    if (view == null) {
        return super.requestFocusInWindow();
    }
    Component left = view.getLeftComponent();
    if (left == null) {
        return super.requestFocusInWindow();
    }
    return left.requestFocusInWindow();
}
 
源代码6 项目: netbeans   文件: ResultWindow.java
public void actionPerformed(ActionEvent e) {
    JSplitPane view = getCurrentResultView();
    if (view == null || !(view.getLeftComponent() instanceof StatisticsPanel)) {
        return;
    }
    StatisticsPanel statisticsPanel = (StatisticsPanel) view.getLeftComponent();
    if (next) {
        statisticsPanel.selectNextFailure();
    } else {
        statisticsPanel.selectPreviousFailure();
    }
}
 
源代码7 项目: netbeans   文件: ResultWindow.java
private static StatisticsPanel getStatisticsPanel() {
JSplitPane view = getCurrentResultView();
if (view == null || !(view.getLeftComponent() instanceof StatisticsPanel)) {
    return null;
}
return (StatisticsPanel) view.getLeftComponent();
   }
 
源代码8 项目: visualvm   文件: JCompoundSplitPane.java
private Component getFirstComponent(JSplitPane splitPane) {
    if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
        return splitPane.getLeftComponent();
    } else {
        return splitPane.getTopComponent();
    }
}
 
源代码9 项目: HiJson   文件: MainView.java
private JTextArea getTextArea(){
    int selIndex = getTabIndex();
    if(selIndex >= 0){
        TabData selTabData = tabDataModel.getTab(selIndex);
        JSplitPane selSplitPane = (JSplitPane)selTabData.getComponent();
        JScrollPane sp = (JScrollPane)selSplitPane.getLeftComponent();
        JViewport vp = (JViewport)sp.getComponent(0);
        JTextArea ta = (JTextArea)vp.getComponent(0);
        return ta;
    }
    return null;
}
 
源代码10 项目: HiJson   文件: MainView.java
private JTree getTree(TabData tabData){
    if(tabData==null){
        return null;
    }
    JSplitPane selSplitPane = (JSplitPane)tabData.getComponent();
    JSplitPane rightSplitPane = (JSplitPane)selSplitPane.getRightComponent();
    JScrollPane sp = (JScrollPane)rightSplitPane.getLeftComponent();
    JViewport vp = (JViewport)sp.getComponent(0);
    JTree t = (JTree)vp.getComponent(0);
    return t;
}
 
源代码11 项目: netbeans   文件: ResultWindow.java
private void copyFilterMask(JSplitPane oldView, JSplitPane newView) {
    StatisticsPanel oldSP = (StatisticsPanel)oldView.getLeftComponent();
    StatisticsPanel newSP = (StatisticsPanel)newView.getLeftComponent();
    newSP.copyFilterMask(oldSP);
}