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

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

Introduction

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

Prototype

@Nullable
    public JComponent getLastComponent() 

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  a v  a  2 s.c  o  m
            threePane.setLastSize(residualHeightAfter / 2);
        }
    }
}