title: How to resize components related to panel in swing?
body: <p>I want to resize child components related to its parent(Panel).</p>
  
  <p>I am using the following method:</p>
  
  <pre><code>@Override
  public Dimension getPreferredSize() {
  Dimension d = getParent().getSize();
  int w = d.width * wid / 100;
  int h = d.height * he / 100;
  //System.out.println("x"+w+"h"+h);
  return new Dimension(w,h);
  }
  </code></pre>
  
  <p>But it doesn't solve my problem. Can anybody tell if there is another way to resize component?</p>