Question
Hi , i have a created a board using javafx in java and on the right side i want to create side/menu bar vertically. I
Hi , i have a created a board using javafx in java and on the right side i want to create side/menu bar vertically. I have the code for the board but i need to create the side bar, any help will be appreciated. i have attached the code for the board below. thank you!
import javafx.application.Application; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.scene.layout.*; import javafx.scene.control.Label; import javafx.scene.control.Button; import javafx.event.*; import javafx.scene.input.*; import javafx.scene.layout.Pane; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.scene.layout.HBox; import javafx.scene.text.Font; import javafx.scene.layout.VBox; import javafx.scene.control.Label; import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.scene.layout.FlowPane; import javafx.geometry.Insets; import javafx.scene.control.ToolBar;
public class Board extends Application { Stage primaryStage; Scene scene; private GridPane root; private Button [][] gridButtons = new Button[10][10];
public static void main(String[] args){ launch(args);
} @Override public void start (Stage primaryStage) throws Exception{ GridPane grid = new GridPane(); //GridPane grid2 = new GridPane(); for(int row = 0; row < 10 ; row++){ for(int column = 0; column <10; column ++){ Button b = new Button(""); gridButtons[row][column] = b; gridButtons[row][column].setPrefSize(30, 30); grid.add(gridButtons[row][column] , row , column); grid.setGridLinesVisible(true);
} } VBox vbox = new VBox(); vbox.getChildren().add(grid); scene = new Scene(vbox, 600, 600);
primaryStage.setTitle("Board"); primaryStage.setScene(scene); primaryStage.show();
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started