Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.77 KB | None | 0 0
  1. package sample;
  2.  
  3. import javafx.event.ActionEvent;
  4. import javafx.fxml.FXML;
  5. import javafx.fxml.FXMLLoader;
  6. import javafx.scene.Parent;
  7. import javafx.scene.Scene;
  8. import javafx.scene.control.Button;
  9. import javafx.stage.Stage;
  10.  
  11.  
  12. import java.io.IOException;
  13.  
  14.  
  15. public class MainMenu {
  16.  
  17. @FXML Button Goals_Main;
  18. @FXML Button Habits_Main;
  19.  
  20.  
  21.  
  22.     @FXML
  23.     public void changeScreenToGoals(ActionEvent event) throws IOException {
  24.  
  25.         Parent GoalsViewParent = FXMLLoader.load(getClass().getResource("Goals.fxml"));
  26.         Scene GoalsViewScene = new Scene(GoalsViewParent);
  27.  
  28.         Stage Goals_window = (Stage) ((javafx.scene.Node) event.getSource()).getScene().getWindow();
  29.         Goals_window.setScene(GoalsViewScene);
  30.         Goals_window.show();
  31.  
  32.     }
  33.  
  34.     @FXML
  35.     public void changeScreenToHabits(ActionEvent event) throws IOException {
  36.         Parent HabitsViewParent = FXMLLoader.load(getClass().getResource("Habits.fxml"));
  37.         Scene HabitsViewScene = new Scene(HabitsViewParent);
  38.  
  39.         Stage Habits_window = (Stage) ((javafx.scene.Node) event.getSource()).getScene().getWindow();
  40.         Habits_window.setScene(HabitsViewScene);
  41.         Habits_window.show();
  42.     }
  43.     @FXML
  44.     public void changeScreenToEditPersonalInfo(ActionEvent event) throws IOException {
  45.         Parent PersonalInfoViewParent = FXMLLoader.load(getClass().getResource("PersonalInformation.fxml"));
  46.         Scene PersonalInfoViewScene = new Scene(PersonalInfoViewParent);
  47.  
  48.         Stage PersonalInfo_window = (Stage) ((javafx.scene.Node) event.getSource()).getScene().getWindow();
  49.         PersonalInfo_window.setScene(PersonalInfoViewScene);
  50.         PersonalInfo_window.show();
  51.     }
  52.  
  53.  
  54.  
  55.     public void Exit(ActionEvent event) {
  56.         System.exit(0);
  57.     }
  58.  
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement