title: How to set the size of JTextPane according to the size of JPanel?
body: <p>I want to set the size of the JTextPane according to the size of the panel so that when i add other panels, it changes accordingly. But it just gives a small text pane in the center and when i add some text, it's size changes accordingly.</p>
  
  <pre><code>JPanel panel = new JPanel();
  JTextPane txt = new JTextPane();
  JScrollPane pane = new JScrollPane();
  pane.add(txt);
  panel.add(pane,BorderLayout.CENTER);
  add(pane);
  </code></pre>
  
  <p>now the jtextpane just appears at the center of the screen like a small box. I want it to appear according to the size of the panel</p>