title: How do I set the relative position of a button?
body: <p>Now I have a panel called panel1, and I would like to place a button on panel1, and set the position of the button as (30,30). How can I do this?</p>
  
  <p>I tried this, but seems that it is not the right way:(</p>
  
  <pre><code>     int x = panel1.getX();
       int y = panel2.getY();
       button.setLocation(x+30,y+30);
  </code></pre>
  
  <p>Thanks a lot, the layout manager seems to be a good choice, but here is my problem, I need to generate many buttons dynamically on the panel, and the button size is also different. So which layout manager shall I use? According to the tutorial, it seems that there is no such layout manager....A key problem is I don't want the buttons to look like they are organized in grid, for example, button1 at (20,20) size  15, and button 2 at (40,70) size 20, button 3 at (150,40) size 5.....</p>