Browse Source

Fixed scrollPane resize

Veloe 4 years ago
parent
commit
638414855c

BIN
out/production/JavaFxApplication/com/moviesdb/Controller.class


+ 2 - 2
out/production/JavaFxApplication/com/moviesdb/test2.fxml

@@ -96,7 +96,7 @@
         </Menu>
       </menus>
     </MenuBar>
-    <SplitPane dividerPositions="0.3392857142857143, 0.9955357142857143" focusTraversable="true" prefHeight="-1.0" prefWidth="-1.0" style="-fx-background-color: #121212; -fx-border-color: #121212;" stylesheets="@style.css" VBox.vgrow="ALWAYS">
+    <SplitPane dividerPositions="0.3392857142857143, 0.9955357142857143" focusTraversable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="-1.0" prefWidth="-1.0" style="-fx-background-color: #121212; -fx-border-color: #121212;" stylesheets="@style.css" VBox.vgrow="ALWAYS">
       <items>
         <AnchorPane fx:id="filterPane" maxWidth="0.0" minWidth="0.0" prefHeight="550.0" prefWidth="120.0" style="-fx-background-color: #212121;" SplitPane.resizableWithParent="false">
           <children>
@@ -126,7 +126,7 @@
                         <Color red="0.624" green="0.624" blue="0.624" fx:id="x21" />
                      </textFill>
                   </Label>
-                  <ScrollPane fx:id="scrollPane" hbarPolicy="NEVER" layoutX="14.0" layoutY="41.0" prefHeight="499.0" prefWidth="463.0" style="-fx-background-color: transparent; -fx-border-color: #212121;" vbarPolicy="NEVER" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="8.0" AnchorPane.topAnchor="41.0">
+                  <ScrollPane fx:id="scrollPane" hbarPolicy="NEVER" layoutX="14.0" layoutY="41.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="499.0" prefWidth="463.0" style="-fx-background-color: transparent; -fx-border-color: #212121;" vbarPolicy="NEVER" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="8.0" AnchorPane.topAnchor="41.0">
                      <styleClass>
                         <String fx:value="split-pane" />
                         <String fx:value="split-pane-divider" />

+ 19 - 18
src/com/moviesdb/Controller.java

@@ -44,7 +44,6 @@ public class Controller {
 
     public void loadPosters()
     {
-
         my_movie = new Movie();
         my_movie.setName("Back to the Future");
         my_movie.setDuration("1:20");
@@ -74,8 +73,10 @@ public class Controller {
         //fill grid by movies
         moviesGrid.addRow(0, movies[0], movies[1]);
         moviesGrid.addRow(1,movies[4],movies[5]);
+        moviesGrid.addRow(2, movies[6],movies[7]);
+        //moviesGrid.minHeight(moviesGrid.getMinHeight() + 222);
         moviesGrid.setPrefWidth(browserPane.getWidth()-26);
-        moviesGrid.setPrefHeight(browserPane.getHeight()-50);
+        moviesGrid.setPrefHeight(moviesGrid.getHeight()+222);
 
 
     }
@@ -127,10 +128,10 @@ public class Controller {
             //movie.
             detailsPicPane.getChildren().add(detailsImage);
             // 300px is details window width
-            scrollPane.setMaxWidth(browserPane.getWidth()-300);
-            scrollPane.setMaxHeight(browserPane.getHeight());
-            moviesGrid.setMaxWidth(browserPane.getWidth() -300);
-            moviesGrid.setMaxHeight(browserPane.getHeight());
+            scrollPane.setPrefWidth(browserPane.getWidth()-300);
+            scrollPane.setPrefHeight(browserPane.getHeight());
+            moviesGrid.setPrefWidth(browserPane.getWidth() -300);
+            moviesGrid.setPrefHeight(browserPane.getHeight());
             //loadPosters();
 
         }
@@ -141,10 +142,10 @@ public class Controller {
             detailsPane.setPrefWidth(0);
             detailsPane.setMaxWidth(0);
             // 300px is details window width
-            scrollPane.setMaxWidth(browserPane.getWidth()+300);
-            scrollPane.setMaxHeight(browserPane.getHeight());
-            moviesGrid.setMaxWidth(browserPane.getWidth()+300);
-            moviesGrid.setMaxHeight(browserPane.getHeight());
+            scrollPane.setPrefWidth(browserPane.getWidth()+300);
+            scrollPane.setPrefHeight(browserPane.getHeight());
+            moviesGrid.setPrefWidth(browserPane.getWidth()+300);
+            moviesGrid.setPrefHeight(browserPane.getHeight());
         }
     }
 
@@ -165,10 +166,10 @@ public class Controller {
             filterPane.setMaxWidth(300);
             //loadPosters();
             // 300px is filter window width
-            scrollPane.setMaxWidth(browserPane.getWidth()-300);
-            scrollPane.setMaxHeight(browserPane.getHeight());
-            moviesGrid.setMaxWidth(browserPane.getWidth()-300);
-            moviesGrid.setMaxHeight(browserPane.getHeight());
+            scrollPane.setPrefWidth(browserPane.getWidth()-300);
+            scrollPane.setPrefHeight(browserPane.getHeight());
+            moviesGrid.setPrefWidth(browserPane.getWidth() -300);
+            moviesGrid.setPrefHeight(browserPane.getHeight());
         }
         else
         {
@@ -177,10 +178,10 @@ public class Controller {
             filterPane.setMaxWidth(0);
             //loadPosters();
             // 300px is filter window width
-            scrollPane.setMaxWidth(browserPane.getWidth()+300);
-            scrollPane.setMaxHeight(browserPane.getHeight());
-            moviesGrid.setMaxWidth(browserPane.getWidth()+300);
-            moviesGrid.setMaxHeight(browserPane.getHeight());
+            scrollPane.setPrefWidth(browserPane.getWidth()+300);
+            scrollPane.setPrefHeight(browserPane.getHeight());
+            moviesGrid.setPrefWidth(browserPane.getWidth()+300);
+            moviesGrid.setPrefHeight(browserPane.getHeight());
         }
     }
 

+ 2 - 2
src/com/moviesdb/test2.fxml

@@ -96,7 +96,7 @@
         </Menu>
       </menus>
     </MenuBar>
-    <SplitPane dividerPositions="0.3392857142857143, 0.9955357142857143" focusTraversable="true" prefHeight="-1.0" prefWidth="-1.0" style="-fx-background-color: #121212; -fx-border-color: #121212;" stylesheets="@style.css" VBox.vgrow="ALWAYS">
+    <SplitPane dividerPositions="0.3392857142857143, 0.9955357142857143" focusTraversable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="-1.0" prefWidth="-1.0" style="-fx-background-color: #121212; -fx-border-color: #121212;" stylesheets="@style.css" VBox.vgrow="ALWAYS">
       <items>
         <AnchorPane fx:id="filterPane" maxWidth="0.0" minWidth="0.0" prefHeight="550.0" prefWidth="120.0" style="-fx-background-color: #212121;" SplitPane.resizableWithParent="false">
           <children>
@@ -126,7 +126,7 @@
                         <Color red="0.624" green="0.624" blue="0.624" fx:id="x21" />
                      </textFill>
                   </Label>
-                  <ScrollPane fx:id="scrollPane" hbarPolicy="NEVER" layoutX="14.0" layoutY="41.0" prefHeight="499.0" prefWidth="463.0" style="-fx-background-color: transparent; -fx-border-color: #212121;" vbarPolicy="NEVER" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="8.0" AnchorPane.topAnchor="41.0">
+                  <ScrollPane fx:id="scrollPane" hbarPolicy="NEVER" layoutX="14.0" layoutY="41.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="499.0" prefWidth="463.0" style="-fx-background-color: transparent; -fx-border-color: #212121;" vbarPolicy="NEVER" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="8.0" AnchorPane.topAnchor="41.0">
                      <styleClass>
                         <String fx:value="split-pane" />
                         <String fx:value="split-pane-divider" />