|
1 | 1 | package sealey.javafxinventorysystem; |
2 | 2 |
|
| 3 | +import javafx.event.ActionEvent; |
3 | 4 | import javafx.fxml.FXML; |
| 5 | +import javafx.fxml.FXMLLoader; |
4 | 6 | import javafx.fxml.Initializable; |
| 7 | +import javafx.scene.Parent; |
| 8 | +import javafx.scene.Scene; |
5 | 9 | import javafx.scene.control.Button; |
6 | 10 | import javafx.scene.control.TableColumn; |
7 | 11 | import javafx.scene.control.TableView; |
8 | 12 | import javafx.scene.control.TextField; |
| 13 | +import javafx.stage.Stage; |
9 | 14 |
|
| 15 | +import java.io.IOException; |
10 | 16 | import java.net.URL; |
| 17 | +import java.util.Objects; |
11 | 18 | import java.util.ResourceBundle; |
12 | 19 |
|
13 | 20 | public class MainWindow implements Initializable { |
| 21 | + Stage stage; |
| 22 | + Parent scene; |
| 23 | + |
14 | 24 | @FXML |
15 | 25 | private Button addPartButton; |
16 | 26 |
|
@@ -68,6 +78,57 @@ public class MainWindow implements Initializable { |
68 | 78 | @FXML |
69 | 79 | private TextField searchProductText; |
70 | 80 |
|
| 81 | + @FXML |
| 82 | + void onActionAddPart(ActionEvent event) throws IOException { |
| 83 | + stage = (Stage)((Button)event.getSource()).getScene().getWindow(); |
| 84 | + scene = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("AddPart.fxml"))); |
| 85 | + stage.setScene(new Scene(scene)); |
| 86 | + stage.setTitle("Add Part"); |
| 87 | + stage.show(); |
| 88 | + } |
| 89 | + |
| 90 | + @FXML |
| 91 | + void onActionAddProduct(ActionEvent event) throws IOException { |
| 92 | + stage = (Stage)((Button)event.getSource()).getScene().getWindow(); |
| 93 | + scene = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("AddProduct.fxml"))); |
| 94 | + stage.setScene(new Scene(scene)); |
| 95 | + stage.setTitle("Add Product"); |
| 96 | + stage.show(); |
| 97 | + } |
| 98 | + |
| 99 | + @FXML |
| 100 | + void onActionDeletePart(ActionEvent event) { |
| 101 | + System.out.println("Delete Part"); |
| 102 | + } |
| 103 | + |
| 104 | + @FXML |
| 105 | + void onActionDeleteProduct(ActionEvent event) { |
| 106 | + System.out.println("Delete Part"); |
| 107 | + } |
| 108 | + |
| 109 | + @FXML |
| 110 | + void onActionExit(ActionEvent event) { |
| 111 | + System.exit(0); |
| 112 | + } |
| 113 | + |
| 114 | + @FXML |
| 115 | + void onActionModifyPart(ActionEvent event) throws IOException { |
| 116 | + stage = (Stage)((Button)event.getSource()).getScene().getWindow(); |
| 117 | + scene = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("ModifyPart.fxml"))); |
| 118 | + stage.setScene(new Scene(scene)); |
| 119 | + stage.setTitle("Modify Part"); |
| 120 | + stage.show(); |
| 121 | + } |
| 122 | + |
| 123 | + @FXML |
| 124 | + void onActionModifyProduct(ActionEvent event) throws IOException { |
| 125 | + stage = (Stage)((Button)event.getSource()).getScene().getWindow(); |
| 126 | + scene = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("ModifyProduct.fxml"))); |
| 127 | + stage.setScene(new Scene(scene)); |
| 128 | + stage.setTitle("ModifyProduct"); |
| 129 | + stage.show(); |
| 130 | + } |
| 131 | + |
71 | 132 | @Override |
72 | 133 | public void initialize(URL url, ResourceBundle resourceBundle) { |
73 | 134 | System.out.println("initialized"); |
|
0 commit comments