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

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

源代码1 项目: chipster   文件: SimpleInternalFrame.java
/**
 * Returns true if the frame is maximized
 * @return
 */
public boolean isMaximized(){
	if(this.getParent() instanceof JSplitPane){
		JSplitPane split = ((JSplitPane)this.getParent());
		if(split.getTopComponent() == this){
			if(split.getDividerLocation() == split.getHeight() - (gradientPanel.getHeight() + split.getDividerSize() + SPLIT_MARGIN)){
				logger.debug("is a maximized top component");
				return true;
			} else {
				logger.debug("is not a maximized component, but it is a top component");
				return false;
			}
		} else {
			if(split.getDividerLocation() == gradientPanel.getHeight()){
				logger.debug("is a maximized bottom component");
				return true;
			} else {
				logger.debug("is not a maximized component, but is is a bottom component");
				return false;
			}
		}
	} else {
		throw new IllegalStateException("SimpleInternalFrame is not on a split pane");
	}
}
 
源代码2 项目: chipster   文件: SimpleInternalFrame.java
/**
    * Maximizes the frame if it is on a split pane and user double clicks 
    * to the title panel
    */
public void mouseClicked(MouseEvent e) {
	
	if(SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2){
		if(this.getParent() instanceof JSplitPane){
			JSplitPane split = (JSplitPane)this.getParent();
			
			int maximizedDividerLocation = 0;
			
			if(split.getTopComponent() == this) {
				maximizedDividerLocation = split.getHeight() - (gradientPanel.getHeight() + split.getDividerSize() + SPLIT_MARGIN);
			} else {
				maximizedDividerLocation = gradientPanel.getHeight();
			}
			
			if (isMaximized()) {
				split.setDividerLocation(split.getLastDividerLocation());
			} else {
				split.setDividerLocation(maximizedDividerLocation);
			}
		}
	}
}
 
源代码3 项目: netbeans   文件: JCompoundSplitPane.java
private Component getFirstComponent(JSplitPane splitPane) {
    if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
        return splitPane.getLeftComponent();
    } else {
        return splitPane.getTopComponent();
    }
}
 
源代码4 项目: visualvm   文件: JCompoundSplitPane.java
private Component getFirstComponent(JSplitPane splitPane) {
    if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
        return splitPane.getLeftComponent();
    } else {
        return splitPane.getTopComponent();
    }
}