title: How to overlay a Jbutton over a JprogressBar
body: <p>I'm working on a swing GUI, and i'd like to overlay a button over a progressBar.
  I have already wrote the code which update the progress bar and the button event, but i don't know how to manage the Layout!</p>
  
  <p>currently the panel code is the following: </p>
  
  <pre><code>public static void main(String[] args) throws IOException {
  
          JFrame myFrame = new JFrame("myJfTitle");
          myFrame.setLayout(new BorderLayout());
          JPanel myPanel = new JPanel();
          JButton myButton = new JButton("Click me");
          JProgressBar myBar = new JProgressBar();
          myBar.setValue(50);
          myPanel.add(myButton);
          myPanel.add(myBar);
          myFrame.add(myPanel,BorderLayout.CENTER);
          myFrame.setVisible(true);
  }
  </code></pre>
  
  <p>which gives the following result:</p>
  
  <p><a href="https://i.stack.imgur.com/OYCZ8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OYCZ8.png" alt="enter image description here"></a></p>
  
  <p>I'm trying unsuccesfully to obtain this: </p>
  
  <p><a href="https://i.stack.imgur.com/rR5LG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rR5LG.png" alt="enter image description here"></a></p>
  
  <p>Can anyone explain me which kind of Layout (or whatever) should i use, or link me same reference from which i can read how to do it??</p>
  
  <p>UPDATE:</p>
  
  <p>by adding the following code, i managed to overly the 2 components, but i m still not able to enlarge the progress bar to fit the panel size:</p>
  
  <pre><code>LayoutManager overlay = new OverlayLayout(myPanel);
  myPanel.setLayout(overlay);
  </code></pre>