title: Swing: set a fixed window size for JDialog
body: <p>I tried <strong>setPrefferedSize</strong> and <strong>setSize</strong> methods, but the dialog still opens at minimum size.</p>
  
  <pre><code>private void method() {
      commandDialog.setPreferredSize(new Dimension(100,100));
      - - - 
      - - -   //Components added to dialogPanel
  
      commandDialog.add(dialogPanel);
  
      // Tried this as well: commandDialog.setSize(40, 40);     
      commandDialog.validate();
      commandDialog.setVisible(true);
  }
  </code></pre>