Example usage for javax.swing JSplitPane getOrientation

List of usage examples for javax.swing JSplitPane getOrientation

Introduction

In this page you can find the example usage for javax.swing JSplitPane getOrientation.

Prototype

public int getOrientation() 

Source Link

Document

Returns the orientation.

Usage

From source file:Main.java

public static float getDividerProportion(JSplitPane splitPane) {
    if (splitPane == null)
        return 0;

    int size = splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? splitPane.getWidth()
            : splitPane.getHeight();/*from   www . jav a  2  s  . c o m*/
    int divLoc = splitPane.getDividerLocation();
    return size == 0 ? 0 : (float) divLoc / ((float) size - splitPane.getDividerSize());
}

From source file:Main.java

public static int getSplitPaneSize(JSplitPane splitPane) {
    if (splitPane == null)
        return 0;

    boolean horiz = splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? true : false;
    return horiz ? splitPane.getWidth() : splitPane.getHeight();
}

From source file:op.tools.SYSTools.java

public static Integer getDividerInAbsolutePosition(JSplitPane mysplit, double pos) {
    int max;//from w ww  .  j  ava 2 s  .  c o m
    if (mysplit.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
        max = mysplit.getWidth();
    } else {
        max = mysplit.getHeight();
    }
    return new Double(max * pos).intValue();
}