Example usage for com.intellij.openapi.ui ThreeComponentsSplitter setFirstSize

List of usage examples for com.intellij.openapi.ui ThreeComponentsSplitter setFirstSize

Introduction

In this page you can find the example usage for com.intellij.openapi.ui ThreeComponentsSplitter setFirstSize.

Prototype

public void setFirstSize(final int size) 

Source Link

Usage

From source file:com.android.tools.idea.editors.gfxtrace.GfxTraceViewPanel.java

License:Apache License

public void resize() {
    ThreeComponentsSplitter threePane = getThreePanes();

    assert (threePane.getLastComponent() instanceof JBSplitter);
    JBSplitter bottomSplitter = (JBSplitter) threePane.getLastComponent();

    assert (threePane.getInnerComponent() instanceof JBSplitter);
    JBSplitter middleSplitter = (JBSplitter) threePane.getInnerComponent();

    int scrubberHeight = getScrubberScrollPane().getMinimumSize().height;
    if (threePane.getFirstSize() < scrubberHeight) {
        int totalHeight = threePane.getHeight();
        int residualHeightAfter = Math.max(0, totalHeight - scrubberHeight);

        threePane.setFirstSize(scrubberHeight);
        int middleSize = middleSplitter.getPreferredSize().height;
        int bottomSize = bottomSplitter.getPreferredSize().height;
        if (bottomSize + middleSize > 0) {
            threePane.setLastSize(residualHeightAfter * bottomSize / (bottomSize + middleSize)); // Split the middle and bottom panes evenly.
        } else {//w w w .j ava  2s  .com
            threePane.setLastSize(residualHeightAfter / 2);
        }
    }
}