public int getHorizontalDivider() { int location = horizontalSplitPane.getSize().width - horizontalSplitPane.getInsets().left - horizontalSplitPane.getDividerSize() - horizontalSplitPane.getRightComponent().getWidth(); double width = indexingFrame.getWidth(); double proportionalLocation = location / width; // horizontalSplitPane.setDividerLocation(proportionalLocation); return location; }
public int getVerticalDivider() { int location = verticalSplitPane.getSize().height - verticalSplitPane.getInsets().bottom - verticalSplitPane.getDividerSize() - verticalSplitPane.getBottomComponent().getHeight(); double height = indexingFrame.getHeight(); double proportionalLocation = location / height; // verticalSplitPane.setDividerLocation(proportionalLocation); // double check = verticalSplitPane.getDiv return location; }
/** Size the divider to the currently selected panel's preferred Size */ private void resizeSelectedComponent() { /* * Set default resize behavior based on the currently * selected panel's preferredSize setting */ Component panel = tabbedPane.getSelectedComponent(); // Make sure we're not being notified that we've deleted // the last panel int width = 0; if (panel != null && cytoPanelContainer instanceof JSplitPane) { JSplitPane jsp = (JSplitPane) cytoPanelContainer; // if the panel is 0x0, it's probably not created, yet if (panel.getSize().width == 0 && panel.getSize().height == 0) return; if (panel.getPreferredSize() != null) { width = panel.getPreferredSize().width; } if (compassDirection == CytoPanelName.WEST) { if (width > WEST_MAX_WIDTH) width = WEST_MAX_WIDTH; else if (width < WEST_MIN_WIDTH) width = WEST_MIN_WIDTH; jsp.setDividerLocation(width + jsp.getInsets().left + jsp.getInsets().right); } else if (compassDirection == CytoPanelName.EAST) { if (width > EAST_MAX_WIDTH) width = EAST_MAX_WIDTH; else if (width < EAST_MIN_WIDTH) width = EAST_MIN_WIDTH; jsp.setDividerLocation( jsp.getSize().width - jsp.getInsets().right - jsp.getInsets().left - jsp.getDividerSize() - width); } // TODO: What's the right thing to do with SOUTH? } }