title: JDialog fixed height
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/8023633/jdialog-allow-user-to-only-change-width-of-the-dialog">JDialog allow user to only change width of the dialog</a>  </p>
  </blockquote>
  
  
  
  <p>I have a JDialog that I would like the width to be resizable, but the height not.</p>
  
  <p>This is my current code:</p>
  
  <pre><code>addComponentListener(new ComponentAdapter() {
      @Override
      public void componentResized(ComponentEvent e) {
          setLocation(getLocation().x, getLocation().y + (getHeight() - staticHeight));
          setSize(new Dimension(getWidth(), staticHeight));
          super.componentResized(e);
      }
  });
  </code></pre>
  
  <p>Problem is, that code gets called after the window is resized. Making the window resize and then flicker back.</p>
  
  <p>I would like to make it so when the user trys to drag the height of the window it does nothing.</p>