title: How to set JTextArea size?
body: <p>I want to set a fixed size for <code>JtextArea</code> within <code>JOptionPane</code> </p>
  
  <pre><code>public static void main(String[] args) {
  
          JTextArea headersTxt = new JTextArea();
          for (int i = 0 ; i &lt; 50 ; i ++ ) {
              headersTxt.append("test \n") ;
          }
          JScrollPane scroll = new JScrollPane(headersTxt); 
          scroll.setSize (300,600) ;  // this line silently ignored
          int test = JOptionPane.showConfirmDialog(null,  scroll,"test",  JOptionPane.OK_CANCEL_OPTION) ;
  
      }
  </code></pre>
  
  <p>However, the above code ignores <code>scroll.setSize (300,600) ;</code> </p>
  
  <p>It works fine but the size is not fixed  .  What is the problem with <code>scroll.setSize (300,600) ;</code> ?</p>