page flow done for now
This commit is contained in:
@@ -17,25 +17,81 @@ import javafx.scene.layout.GridPane;
|
||||
public class App extends Application {
|
||||
static public School school_;
|
||||
|
||||
// next 3 methods are just here to populate the scene with items insede them
|
||||
public Scene setStudentScene(Stage stage, Scene _prevScene) {
|
||||
GridPane _layout = new GridPane();
|
||||
// make the buttons
|
||||
Button addButton = new Button("Add student");
|
||||
Button returnButton = new Button("Return");
|
||||
// adding buttons to the scene's layout
|
||||
_layout.add(addButton, 1,0,1,1);
|
||||
_layout.add(returnButton, 1,1,1,1);
|
||||
|
||||
// add event listeners for the buttons
|
||||
returnButton.setOnAction(e-> stage.setScene(_prevScene));
|
||||
// finally return a new scene with the finished layout
|
||||
Scene ret = new Scene(_layout, 1280, 720);
|
||||
return ret;
|
||||
}
|
||||
public Scene setInstructorScene(Stage stage, Scene _prevScene) {
|
||||
GridPane _layout = new GridPane();
|
||||
// buttons for this page
|
||||
Button addButton = new Button("Add instructor");
|
||||
Button setButton = new Button("Assign to course");
|
||||
Button returnButton = new Button("Return");
|
||||
|
||||
// setup buttons
|
||||
_layout.add(addButton, 1,0,1,1);
|
||||
_layout.add(setButton, 1,1,1,1);
|
||||
_layout.add(returnButton, 1,2,1,1);
|
||||
|
||||
returnButton.setOnAction(e -> stage.setScene(_prevScene));
|
||||
Scene ret = new Scene(_layout, 1280, 720);
|
||||
return ret;
|
||||
}
|
||||
public Scene setCourseScene(Stage stage, Scene _prevScene) {
|
||||
GridPane _layout = new GridPane();
|
||||
|
||||
Button addButton = new Button("Add course");
|
||||
Button deleteButton = new Button("Delete course");
|
||||
Button returnButton = new Button("Return");
|
||||
|
||||
_layout.add(addButton, 1,0,1,1);
|
||||
_layout.add(deleteButton, 1,1,1,1);
|
||||
_layout.add(returnButton, 1,2,1,1);
|
||||
|
||||
returnButton.setOnAction(e -> stage.setScene(_prevScene));
|
||||
Scene ret = new Scene(_layout, 1280, 720);
|
||||
return ret;
|
||||
}
|
||||
@Override
|
||||
public void start(Stage stage) {
|
||||
// make the initial menu with three buttons
|
||||
stage.setTitle("School App");
|
||||
// main menu buttons
|
||||
|
||||
// Main menu comes first
|
||||
GridPane grid = new GridPane();
|
||||
Button instButton = new Button("Instructors");
|
||||
Button studButton = new Button("Students");
|
||||
Button courButton = new Button("Courses");
|
||||
|
||||
// creating the initial scene to draw thigns onto
|
||||
GridPane grid = new GridPane();
|
||||
Button courseButton = new Button("Courses");
|
||||
// add those buttons to the main_menu scene
|
||||
grid.add(instButton, 1, 0, 1, 1);
|
||||
grid.add(studButton, 1, 1, 1, 1);
|
||||
grid.add(courButton, 1, 2, 1, 1);
|
||||
grid.add(courseButton, 1, 2, 1, 1);
|
||||
|
||||
Scene scene = new Scene(grid, 1280, 720);
|
||||
stage.setScene(scene);
|
||||
Scene main_menu = new Scene(grid, 1280, 720);
|
||||
|
||||
// render the scene
|
||||
// next we can create the other menu's
|
||||
Scene studMenu = setStudentScene(stage, main_menu);
|
||||
Scene instMenu = setInstructorScene(stage, main_menu);
|
||||
Scene courMenu = setCourseScene(stage, main_menu);
|
||||
|
||||
// now we can add the event listeners for our main menu as the other scenes now exist
|
||||
instButton.setOnAction(e-> stage.setScene(instMenu));
|
||||
studButton.setOnAction(e-> stage.setScene(studMenu));
|
||||
courseButton.setOnAction(e-> stage.setScene(courMenu));
|
||||
|
||||
stage.setScene(main_menu);
|
||||
stage.show();
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
|
||||
Reference in New Issue
Block a user