把splitPane.setDividerLocation(0.8);这句放到f.show(true);之后

解决方案 »

  1.   

    If the split pane is not correctly realized and on screen, this method will have no effect (new divider location will become (current size * proportionalLocation) which is 0). 仔细看看setDividerLocation方法文档
      

  2.   

    你这个函数用错了
    splitPane.setDividerLocation(0.8); 改为 splitPane.setDividerLocation(200);试一下
    它的参数是整型,in pixels。setDividerLocation
    public void setDividerLocation(int location)Sets the location of the divider. This is passed off to the look and feel implementation, and then listeners are notified. A value less than 0 implies the divider should be reset to a value that attempts to honor the preferred size of the left/top component. After notifying the listeners, the last divider location is updated, via setLastDividerLocation. Parameters:
    location - an int specifying a UI-specific value (typically a pixel count)