Skip to content

Commit

Permalink
Fixed ScrollPane
Browse files Browse the repository at this point in the history
  • Loading branch information
AllKeng committed Dec 6, 2023
1 parent 101e75c commit 20c22d6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
27 changes: 15 additions & 12 deletions app/src/main/java/code/client/View/AppFrameHome.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,37 +93,40 @@ public MenuButton getFilterMenuButton() {
}
}

public class AppFrameHome extends BorderPane {
public class AppFrameHome extends VBox {
private Header header;
private Footer footer;
private RecipeListUI recipeList;
private ScrollPane scroller;
private Button newButton, logOutButton;

AppFrameHome() throws IOException {

header = new Header();
recipeList = new RecipeListUI();
footer = new Footer();
ScrollPane scroller = new ScrollPane(recipeList);
scroller.setMaxSize(400,400);
scroller.setVbarPolicy(ScrollBarPolicy.ALWAYS);
this.setTop(header);
this.setCenter(scroller);
this.setBottom(footer);
scroller = new ScrollPane(recipeList);
scroller.setFitToWidth(true);
scroller.setFitToHeight(true);

this.getChildren().addAll(header,scroller,footer);
// this.setTop(header);
// this.setCenter(scroller);
// this.setBottom(footer);
newButton = footer.getNewButton();
logOutButton = footer.getLogOutButton();
BorderPane.setAlignment(this, Pos.CENTER);

}

public BorderPane getRoot() {
public VBox getRoot() {
// stack.getChildren().clear();
// stack.getChildren().add(this);
this.updateDisplay("none");
return this;
}

public void updateDisplay(String filter) {
recipeList.update(filter);
this.setCenter(recipeList);
this.getChildren().clear();
this.getChildren().addAll(header,scroller,footer);
}

public void setNewRecipeButtonAction(EventHandler<ActionEvent> eventHandler) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/code/client/View/RecipeListUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public class RecipeListUI extends VBox {

RecipeListUI() throws IOException {
this.setSpacing(5);
// this.setPrefSize(700, 600);
this.setPrefSize(700, 500);
this.setStyle("-fx-background-color: #F0F8FF;");
//VBox.setVgrow(this, Priority.ALWAYS);
// this.setAlignment(Pos.CENTER);
this.setAlignment(Pos.CENTER);
}

public IRecipeDb getRecipeDB() {
Expand Down

0 comments on commit 20c22d6

Please sign in to comment.