예제 #1
0
 // Many of the following methods have been added purely
 // so InternalFunctions can work.  Originally, the code in
 // that class was inline here, so its functions had direct
 // access.  I removed it so that students do not need to wade
 // through all the functions!  But, that leaves the question as
 // to what to do with the following methods, but I don't think
 // there's much you can do ...
 public void changeSize(int width, int height) {
   setSize(width, height);
   Component top = splitPane.getTopComponent();
   Component bottom = splitPane.getBottomComponent();
   int totalHeight = top.getHeight() + bottom.getHeight();
   int topHeight = (totalHeight * topProportion) / 100;
   int bottomHeight = (totalHeight * bottomProportion) / 100;
   top.setPreferredSize(new Dimension(width - 10, topHeight));
   bottom.setPreferredSize(new Dimension(width - 10, bottomHeight));
   splitPane.resetToPreferredSizes();
   pack();
 }