Java examples for Swing:JSplitPane
set JSplitPane Resize Weight
//package com.java2s; import javax.swing.*; import java.lang.reflect.*; public class Main { public static void setResizeWeight(JSplitPane sp, double weight) { try {//from ww w .j av a2 s. c om Class[] args = new Class[1]; args[0] = Double.TYPE; Method meth = (sp.getClass().getMethod("setResizeWeight", args)); // System.out.println("Setting resize weight"); Object[] objs = new Object[1]; objs[0] = new Double(weight); meth.invoke(sp, objs); } catch (NoSuchMethodException e) { System.out.println("No setResizeWeight"); } catch (IllegalAccessException e) { System.out.println("No access"); } catch (InvocationTargetException e) { System.out.println("No invoke"); } } }