Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import javax.swing.JSplitPane;

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

        int size = splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? splitPane.getWidth()
                : splitPane.getHeight();
        int divLoc = splitPane.getDividerLocation();
        return size == 0 ? 0 : (float) divLoc / ((float) size - splitPane.getDividerSize());
    }
}