title: JFrame resize moves JSplitPane divider
body: <p>I use two <code>JSplitPanes</code> to display some information. One is oriented with a horizontal divider, the other with a vertical divider. The following issue applies to both <code>JSplitPanes</code>.</p>
  
  <p>When I resize my application's main <code>JFrame</code>, the <code>JSplitPanes</code> also resize as they have to occupy a certain percentage of the screen (all <code>JPanels</code> adjust to <code>JFrame</code> resize, behavior set by <code>MigLayout</code>'s width and height parameters).</p>
  
  <p>The divider location is important and needs to be constant with the <code>JSplitPane</code>'s size. I use <code>setResizeWeight()</code> and <code>setDividerLocation()</code> to achieve this.</p>
  
  <p>The main issue is that on <code>JFrame</code> resize, the divider does not remain at 0.0/ 0% but instead moves to ~5-10%:</p>
  
  <p><img src="https://i.stack.imgur.com/JC4ne.png" alt="Pre-resize"> ----->
  <img src="https://i.stack.imgur.com/l9DqO.png" alt="Post-resize"></p>
  
  <p>I thought this is due to the <code>resizeWeight</code> but I played around with it and there was no change in behavior at all.</p>
  
  <p>Can anybody help me out with this problem? I implemented a <code>ComponentAdapter</code> but short of saving the divider's location in a variable or <code>Preferences</code> XML-key I cannot restore the divider's location on <code>componentResized()</code>. </p>
  
  <p>Example code:</p>
  
  <pre><code>import java.awt.Color;
  import java.awt.Dimension;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  
  import javax.swing.JButton;
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  import javax.swing.JSplitPane;
  
  import net.miginfocom.swing.MigLayout;
  
  
  public class JSplitPaneTest {
  
      public static void main(String[] args) {
  
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setMinimumSize(new Dimension(500, 500));
  
          JPanel mainPanel = new JPanel();
          mainPanel.setLayout(new MigLayout());
  
          JPanel panel1 = new JPanel();
          panel1.setBackground(Color.RED);
  
          JPanel panel2 = new JPanel();
          panel1.setBackground(Color.GREEN);
  
          final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
                  panel1, panel2);
          splitPane.setResizeWeight(0.5);
          splitPane.setOpaque(false);
          splitPane.setOneTouchExpandable(true); // does not work on Linux :(
          splitPane.setBorder(null);
  
          mainPanel.add(splitPane, "w 100%, h 90%, wrap");
  
          JButton button = new JButton("Set to 0");
          button.addActionListener(new ActionListener() {
  
              @Override
              public void actionPerformed(ActionEvent e) {
                  splitPane.setDividerLocation(0.0);
              }
          });
  
          mainPanel.add(button, "span");
  
          frame.add(mainPanel);
          frame.setVisible(true);
      }
  }
  </code></pre>