List of usage examples for javax.swing JSplitPane isShowing
public boolean isShowing()
From source file:Main.java
public static JSplitPane setDividerLocation(final JSplitPane splitter, final double proportion) { if (splitter.isShowing()) { if (splitter.getWidth() > 0 && splitter.getHeight() > 0) { splitter.setDividerLocation(proportion); } else {/*from w ww .j a va2 s. c o m*/ splitter.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent ce) { splitter.removeComponentListener(this); setDividerLocation(splitter, proportion); } }); } } else { splitter.addHierarchyListener(new HierarchyListener() { @Override public void hierarchyChanged(HierarchyEvent e) { if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 && splitter.isShowing()) { splitter.removeHierarchyListener(this); setDividerLocation(splitter, proportion); } } }); } return splitter; }
From source file:Main.java
/** * Force divider location for a JSplitPan with int position. * * @param splitter/*ww w . jav a2 s .c o m*/ * @param position * @return */ public static JSplitPane setDividerLocation(final JSplitPane splitter, final int position) { if (splitter.isShowing()) { if (splitter.getWidth() > 0 && splitter.getHeight() > 0) { splitter.setDividerLocation(position); } else { splitter.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent ce) { splitter.removeComponentListener(this); setDividerLocation(splitter, position); } }); } } else { splitter.addHierarchyListener(new HierarchyListener() { @Override public void hierarchyChanged(HierarchyEvent e) { if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 && splitter.isShowing()) { splitter.removeHierarchyListener(this); setDividerLocation(splitter, position); } } }); } return splitter; }
From source file:Main.java
/** * Force divider location for a JSplitPan in percent. * * @param splitter/* w ww .j a va2 s .c o m*/ * @param proportion * @return */ public static JSplitPane setDividerLocation(final JSplitPane splitter, final double proportion) { if (splitter.isShowing()) { if (splitter.getWidth() > 0 && splitter.getHeight() > 0) { splitter.setDividerLocation(proportion); } else { splitter.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent ce) { splitter.removeComponentListener(this); setDividerLocation(splitter, proportion); } }); } } else { splitter.addHierarchyListener(new HierarchyListener() { @Override public void hierarchyChanged(HierarchyEvent e) { if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 && splitter.isShowing()) { splitter.removeHierarchyListener(this); setDividerLocation(splitter, proportion); } } }); } return splitter; }