I'm trying to create some kind of menu using tree view but I have the following problems : The tree view is small and I want to increase it's size but the css I used seem to not work . The tree is added on a anchor pane and I tried to resize it but there seems to be no change.Not only the items but the tree view doesn't change when I resize the container pane (it covers half of the scene but I want it as a side bar covering the left side of the scene)
public class ManagerPanel {
AnchorPane anchor = new AnchorPane();
public ManagerPanel(){
TreeItem sideBar = new TreeItem();
TreeItem createTest = new TreeItem("create test");
TreeItem addStudents = new TreeItem("add students");
TreeItem addQuestions = new TreeItem("add questions");
createTest.getChildren().addAll(addStudents,addQuestions);
TreeItem chats = new TreeItem("chats");
sideBar.getChildren().addAll(createTest,chats);
TreeView treeView = new TreeView();
treeView.setRoot(sideBar);
treeView.setShowRoot(false);
AnchorPane container = new AnchorPane(treeView);
treeView.getStyleClass().add("Tree.css");
anchor.getChildren().add(container);
Scene scene = new Scene(anchor);
Stage stage = new Stage();
stage.setWidth(1300);
stage.setHeight(800);
stage.setScene(scene);
stage.show();
}
}
I need to change the font too but nothing happens . This is the code I used in the css file :
.Tree .tree-cell{
-fx-font: 20px "Calibri Light";
-fx-stroke: #eeeeee;
-fx-background-color: brown;
-fx-text-fill: navajowhite;
-fx-font-size: 20;
}
Thank you in advance :)
ps. I gave up on making it right aligned since I don't have much time and there isn't a lot of data about it.