title: How can I stack download panes vertically using JavaFX?
body: <p>I have a method which returns a pane and on that pane are some Buttons and a ProgressBar used to render the progress of a pending download while allowing the user to pause, resume or cancel it:</p>
  
  <p><img src="https://i.stack.imgur.com/cgitx.png" alt="screenshot of the download manager with one pane showing progress along with pause, resume, cancel controls for managing the download"></p>
  
  <p>My problem is that when whenever I start a new download I want to add a new pane below the last one, stacking them vertically as new downloads are started. However, the logic I've created opens a new pane in the same position as the last one - overlaying it. </p>
  
  <p>How can I make these panes stack?</p>
  
  <h3>What I've tried</h3>
  
  <pre><code>package DownloadManager;
  
  import java.io.File;
  import java.util.ArrayList;
  
  import javafx.application.Application;
  import javafx.collections.ObservableList;
  import javafx.scene.Group;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.scene.control.Label;
  import javafx.scene.control.ListView;
  import javafx.scene.control.ProgressBar;
  import javafx.scene.control.ProgressIndicator;
  import javafx.scene.control.TableView;
  import javafx.scene.control.TextField;
  import javafx.scene.image.Image;
  import javafx.scene.image.ImageView;
  import javafx.scene.layout.BorderPane;
  import javafx.scene.layout.HBox;
  import javafx.scene.layout.Pane;
  import javafx.scene.layout.VBox;
  import javafx.scene.paint.Color;
  import javafx.stage.Stage;
  
  public class ProgressClass {
  
      public Pane show( DownloadAction ob,Button pause,Button resume,Button delete,Thread thread) 
      {
  
  
          File resumefile = new File("C:\\Users\\kamran ali\\Desktop\\play.png");
          File pausefile = new File("C:\\Users\\kamran ali\\Desktop\\pause1.png");
          File deletefile = new File("C:\\Users\\kamran ali\\Desktop\\delete1.png");
  
  
          Image resIcon = new Image(resumefile.toURI().toString());
          Image paseIcon = new Image(pausefile.toURI().toString());
          Image delIcon = new Image(deletefile.toURI().toString());
  
  
  
          ImageView icon0 = new ImageView(resIcon);
          ImageView icon1 = new ImageView(paseIcon);
          ImageView icon2 = new ImageView(delIcon);
          icon0.setFitWidth(10);
          icon0.setFitHeight(10);
          icon1.setFitWidth(10);
          icon1.setFitHeight(10);
  
          icon2.setFitWidth(10);
          icon2.setFitHeight(10);
  
  
           pause  = new Button(null,icon1);
           resume  = new Button(null,icon0);
           delete= new Button(null,icon2);
  
          pause.setLayoutX(270);
          resume.setLayoutX(300);
          delete.setLayoutX(330);
  
          pause.setLayoutY(120);
          resume.setLayoutY(120);
          delete.setLayoutY(120);
  
          pause.setOnAction(e-&gt;{
              thread.suspend();
          });
  
          resume.setOnAction(e-&gt;{
              thread.resume();
          });
  
          ProgressBar pb = new ProgressBar(0.0);
          ProgressIndicator pi = new ProgressIndicator(0.0);
          Label label = new Label();
          label.setLayoutX(100);
          label.setLayoutY(80);
          label.setText(ob.getpath());
          pi.setLayoutX(510);
          pi.setLayoutY(80);
          pi.setPrefSize(50, 50);
          pb.setLayoutX(100);
          pb.setLayoutY(100);
          pb.setPrefWidth(400);
          pb.setProgress(0);
          pb.isIndeterminate();
          pb.progressProperty().unbind();
      pi.progressProperty().bind(ob.progressProperty());
          pb.progressProperty().bind(ob.progressProperty());
          Pane pane1 = new Pane();
      pane1.setLayoutY(40);
          pane1.getChildren().addAll(pb,pi,label,pause,resume,delete);
      return pane1;
      }
  
  
  
  }
  </code></pre>