title: JavaFX How to set max/min window size?
body: <p>Does <code>setMinSize()</code> work on containers such as <code>GridPane</code>, for example? I have found that in my program <code>GridPane</code> ignores min. size properties while resized manually.</p>
  <p>Here is the FXML code:</p>
  
  <pre><code>&lt;GridPane fx:id=&quot;gp&quot; prefHeight=&quot;134.0&quot; prefWidth=&quot;238.0&quot; xmlns:fx=&quot;http://javafx.com/fxml&quot; fx:controller=&quot;javafxapplication12.SampleController&quot;&gt;
    &lt;columnConstraints&gt;
      &lt;ColumnConstraints hgrow=&quot;SOMETIMES&quot; minWidth=&quot;10.0&quot; prefWidth=&quot;100.0&quot; /&gt;
      &lt;ColumnConstraints hgrow=&quot;SOMETIMES&quot; minWidth=&quot;10.0&quot; prefWidth=&quot;100.0&quot; /&gt;
    &lt;/columnConstraints&gt;
    &lt;rowConstraints&gt;
      &lt;RowConstraints minHeight=&quot;10.0&quot; prefHeight=&quot;30.0&quot; vgrow=&quot;SOMETIMES&quot; /&gt;
      &lt;RowConstraints minHeight=&quot;10.0&quot; prefHeight=&quot;30.0&quot; vgrow=&quot;SOMETIMES&quot; /&gt;
      &lt;RowConstraints minHeight=&quot;10.0&quot; prefHeight=&quot;30.0&quot; vgrow=&quot;SOMETIMES&quot; /&gt;
    &lt;/rowConstraints&gt;
  &lt;/GridPane&gt;
  </code></pre>
  <p>and the controller class</p>
  <pre class="lang-java prettyprint-override"><code>public class SampleController implements Initializable {
      
      @FXML
      private GridPane gp;
      
      @Override
      public void initialize(URL url, ResourceBundle rb) {
          gp.setMaxWidth(700);
          gp.setMinSize(200, 200);
      }
  }
  </code></pre>
  <p>What's wrong here? Should there be some sort of a 'window' max/min size?</p>