java - JavaFX make content fit to Gridpane cell -


so, trying let user upload pictures gridpane

so far managed pictures shown, problem if window size changed pictures stay same size.

i tried using computed sizes margins doesn't work way want it.

pic 1, way want be:

http://imgur.com/1xjvpff

pic 2, how gets displayed

http://imgur.com/a/b2cmd

edit: here's code of tab pictures:

 <tab closable="false" text="bilder">      <content>         <gridpane>           <columnconstraints>             <columnconstraints hgrow="sometimes" minwidth="10.0" prefwidth="100.0" />               <columnconstraints hgrow="sometimes" minwidth="10.0" prefwidth="100.0" />               <columnconstraints hgrow="sometimes" minwidth="10.0" prefwidth="100.0" />               <columnconstraints hgrow="sometimes" minwidth="10.0" prefwidth="100.0" />             <columnconstraints hgrow="sometimes" minwidth="10.0" prefwidth="100.0" />           </columnconstraints>           <rowconstraints>             <rowconstraints minheight="10.0" prefheight="30.0" vgrow="sometimes" />               <rowconstraints minheight="10.0" prefheight="30.0" vgrow="sometimes" />               <rowconstraints minheight="10.0" prefheight="30.0" vgrow="sometimes" />             <rowconstraints minheight="10.0" prefheight="30.0" vgrow="sometimes" />             <rowconstraints minheight="10.0" prefheight="30.0" vgrow="sometimes" />           </rowconstraints>            <children>               <button fx:id="addpic" mnemonicparsing="false" onaction="#chosefile" text="bild hinzuĆ¼gen" gridpane.columnindex="4" gridpane.halignment="right" gridpane.rowindex="4">                  <gridpane.margin>                     <insets bottom="5.0" left="5.0" right="5.0" top="5.0" />                  </gridpane.margin>               </button>               <imageview fx:id="image1" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.hgrow="always" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image2" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="1" gridpane.hgrow="always" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image3" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="2" gridpane.hgrow="always" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image4" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="3" gridpane.hgrow="always" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image5" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="4" gridpane.hgrow="always" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image6" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.hgrow="always" gridpane.rowindex="1" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image7" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="1" gridpane.hgrow="always" gridpane.rowindex="1" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin>               </imageview>               <imageview fx:id="image8" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="2" gridpane.hgrow="always" gridpane.rowindex="1" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image9" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="3" gridpane.hgrow="always" gridpane.rowindex="1" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image10" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="4" gridpane.hgrow="always" gridpane.rowindex="1" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image11" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.hgrow="always" gridpane.rowindex="2" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image12" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="1" gridpane.hgrow="always" gridpane.rowindex="2" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image13" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="2" gridpane.hgrow="always" gridpane.rowindex="2" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image14" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="3" gridpane.hgrow="always" gridpane.rowindex="2" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image15" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="4" gridpane.hgrow="always" gridpane.rowindex="2" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image16" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.hgrow="always" gridpane.rowindex="3" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image17" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="1" gridpane.hgrow="always" gridpane.rowindex="3" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image18" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="2" gridpane.hgrow="always" gridpane.rowindex="3" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image19" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="3" gridpane.hgrow="always" gridpane.rowindex="3" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>               <imageview fx:id="image20" fitheight="110.0" fitwidth="141.0" pickonbounds="true" preserveratio="true" gridpane.columnindex="4" gridpane.hgrow="always" gridpane.rowindex="3" gridpane.vgrow="always">                  <gridpane.margin>                     <insets />                  </gridpane.margin></imageview>            </children>         </gridpane>      </content> </tab> 


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -