@Test public void testShowSplit() { SplittablePane splitPane; splitPane= new SplittablePane(SplittablePane.HORIZONTAL_SPLIT, main, secondary); splitPane.setSize(200, 100); content.add(splitPane, BorderLayout.CENTER); assertTrue(!splitPane.isSplit()); splitPane.showSplit(); assertTrue(splitPane.isSplit()); assertEquals(splitPane.getDividerFraction(), SplittablePane.DEFAULT_DIVIDER_LOCATION, 0.1); splitPane.showSplit(); assertTrue(splitPane.isSplit()); splitPane.hideSplit(); splitPane.setMainComponent(null); splitPane.showSplit(); assertTrue(splitPane.isSplit()); }
public void showSplit() { if (!isSplit) { if (mainComponent != null) { remove(mainComponent); if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { splitPane.setLeftComponent(mainComponent); } else { splitPane.setTopComponent(mainComponent); } } add(splitPane, BorderLayout.CENTER); isSplit = true; validate(); adjustDivider(); } }
SplittablePane extends JPanel { public void showSplit() { if (!isSplit) { if (mainComponent != null) { remove(mainComponent); if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { splitPane.setLeftComponent(mainComponent); } else { splitPane.setTopComponent(mainComponent); } } add(splitPane, BorderLayout.CENTER); isSplit = true; validate(); adjustDivider(); } } }
SplittablePane extends JPanel { public void showSplit() { if (!isSplit) { if (mainComponent != null) { remove(mainComponent); if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { splitPane.setLeftComponent(mainComponent); } else { splitPane.setTopComponent(mainComponent); } } add(splitPane, BorderLayout.CENTER); isSplit = true; validate(); adjustDivider(); } } SplittablePane();  SplittablePane(int orientation, Component mainComponent);  SplittablePane(int orientation, Component mainComponent, Component secondaryComponent); }
SplittablePane extends JPanel { public void showSplit() { if (!isSplit) { if (mainComponent != null) { remove(mainComponent); if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { splitPane.setLeftComponent(mainComponent); } else { splitPane.setTopComponent(mainComponent); } } add(splitPane, BorderLayout.CENTER); isSplit = true; validate(); adjustDivider(); } } SplittablePane();  SplittablePane(int orientation, Component mainComponent);  SplittablePane(int orientation, Component mainComponent, Component secondaryComponent); void setMainComponent(Component component); void setSecondaryComponent(Component secondaryComponent); void hideSplit(); void showSplit(); void saveDividerLocation(); boolean isSplit(); Component getMainComponent(); Component getSecondaryComponent(); void setDividerFraction(double fraction); double getDividerFraction(); @Override void setSize(int width, int height); }
SplittablePane extends JPanel { public void showSplit() { if (!isSplit) { if (mainComponent != null) { remove(mainComponent); if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { splitPane.setLeftComponent(mainComponent); } else { splitPane.setTopComponent(mainComponent); } } add(splitPane, BorderLayout.CENTER); isSplit = true; validate(); adjustDivider(); } } SplittablePane();  SplittablePane(int orientation, Component mainComponent);  SplittablePane(int orientation, Component mainComponent, Component secondaryComponent); void setMainComponent(Component component); void setSecondaryComponent(Component secondaryComponent); void hideSplit(); void showSplit(); void saveDividerLocation(); boolean isSplit(); Component getMainComponent(); Component getSecondaryComponent(); void setDividerFraction(double fraction); double getDividerFraction(); @Override void setSize(int width, int height); static final int HORIZONTAL_SPLIT; static final int VERTICAL_SPLIT; static final double DEFAULT_DIVIDER_LOCATION; }