Skip to content
Snippets Groups Projects
Commit 4389af74 authored by Nicolay Schiøll-Johansen's avatar Nicolay Schiøll-Johansen
Browse files

Added code to extend the gridpane beyond 15 images

parent 66294f69
No related branches found
No related tags found
2 merge requests!165Weekly merge to Master,!144Added code to extend the gridpane beyond 15 images
Pipeline #80084 passed
...@@ -57,17 +57,26 @@ public class Explore implements Initializable { ...@@ -57,17 +57,26 @@ public class Explore implements Initializable {
@Override @Override
public void initialize(URL url, ResourceBundle resourceBundle) { public void initialize(URL url, ResourceBundle resourceBundle) {
List<NTNU.IDATT1002.models.Image> images = new ImageService(App.ex.getEntityManager()).getAllImages(); List<NTNU.IDATT1002.models.Image> images = new ImageService(App.ex.getEntityManager()).getAllImages();
//Limited elements to 15 since grid pane since is 3x15 //Limited elements to 15 since grid pane since is 3x5
//Can implement automatic row adding when this limit exceeded later //Can implement automatic row adding when this limit exceeded later
for(int i = 0; i < images.size() && i < 15; i++) { for(int i = 0; i < images.size() && i < 100; i++) {
//Row and column in gripdane //Row and column in gripdane
int column = i%3; int column = i%3;
int row = (i-column)/3; int row = (i-column)/3;
//Add rows
if(images.size() > 15){
gridPane.setMinHeight(1600 + (((i-15)*160)));
for (int j = 0; j < ((i-15)/3); j++){
gridPane.addRow(j);
}
}
//Make vbox container for content //Make vbox container for content
VBox vBox = new VBox(); VBox vBox = new VBox();
vBox.setPrefHeight(400); vBox.setPrefHeight(400);
vBox.setPrefWidth(400); vBox.setPrefWidth(400);
vBox.setMaxHeight(400);
vBox.setAlignment(Pos.CENTER); vBox.setAlignment(Pos.CENTER);
//vBox.setStyle("-fx-background-color: #999999;"); //vBox.setStyle("-fx-background-color: #999999;");
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</HBox> </HBox>
</children> </children>
</HBox> </HBox>
<ScrollPane fx:id="scrollPane" fitToWidth="true" hbarPolicy="NEVER" prefHeight="980.0" prefWidth="1920.0" VBox.vgrow="ALWAYS" styleClass="scroll-pane" stylesheets="@style.css"> <ScrollPane fx:id="scrollPane" fitToWidth="true" hbarPolicy="NEVER" prefHeight="980.0" prefWidth="1920.0" styleClass="scroll-pane" stylesheets="@style.css" VBox.vgrow="ALWAYS">
<content> <content>
<BorderPane prefHeight="2000.0" prefWidth="1920.0" styleClass="bodybg" stylesheets="@style.css" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <BorderPane prefHeight="2000.0" prefWidth="1920.0" styleClass="bodybg" stylesheets="@style.css" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<top> <top>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment