title: JavaFX FlowPane Autosize
body: <p>The problem I'm having is that the FlowPane is leaving a lot of excess space, it could possibly be the Popup, although I think the popup size is the content size.</p>
  
  <p>For the sake of debugging I've wrapped the text in a BorderPane to show the bounds of the text.</p>
  
  <p>The component I'm focusing on is the error popup.</p>
  
  <p><img src="https://i.stack.imgur.com/0AUUe.png" alt="Screenshot">
  CSS</p>
  
  <pre><code>.warning-popup {
      -fx-padding: 10px;
      -fx-hgap: 10px;
      -fx-vgap: 10px;
      -fx-background-color: #704745;
      -fx-border-color: #C8C8C8;
      -fx-background-radius: 2px;
      -fx-border-radius: 2px;
  }
  
  
  .warning-popup .text {
      -fx-fill: #000000;
  }
  </code></pre>
  
  <p>Java Code</p>
  
  <pre><code>public static void showWarningPopup(Node owner, String message, double screenX, double screenY) {
      // create message text
      Text text = new Text(message);
      text.getStyleClass().add("text");
      // wrap text in container
      Pane textContainer = new BorderPane(text);
      textContainer.setStyle("-fx-background-color: orange;");
      // create error image
      ImageView image = new ImageView("/resources/error-14.png");
      image.getStyleClass().add("image-view");
      // create content
      FlowPane content = new FlowPane(image, textContainer);
      content.getStyleClass().add("warning-popup");
      content.autosize();
      // create and show the popup
      Popup popup = new Popup();
      popup.setHideOnEscape(true);
      popup.setAutoHide(true);
      popup.setAutoFix(true);
      popup.getContent().add(content);
      popup.show(owner, screenX, screenY);
  }
  </code></pre>
  
  <p>Thank you for any help in advance :)</p>