1111import javafx .scene .control .TableView ;
1212import javafx .scene .control .TextField ;
1313import javafx .stage .Stage ;
14+ import sealey .javafxinventorysystem .models .Part ;
1415
1516import java .io .IOException ;
1617import java .net .URL ;
@@ -55,34 +56,34 @@ public class AddProduct implements Initializable {
5556 private TextField searchPartText ;
5657
5758 @ FXML
58- private TableView <? > table1 ;
59+ private TableView <Part > table1 ;
5960
6061 @ FXML
61- private TableColumn <?, ? > table1IDCol ;
62+ private TableColumn <Part , Integer > table1IDCol ;
6263
6364 @ FXML
64- private TableColumn <?, ? > table1InvCol ;
65+ private TableColumn <Part , Integer > table1InvCol ;
6566
6667 @ FXML
67- private TableColumn <?, ? > table1NameCol ;
68+ private TableColumn <Part , String > table1NameCol ;
6869
6970 @ FXML
70- private TableColumn <?, ? > table1PriceCol ;
71+ private TableColumn <Part , Double > table1PriceCol ;
7172
7273 @ FXML
73- private TableView <? > table2 ;
74+ private TableView <Part > table2 ;
7475
7576 @ FXML
76- private TableColumn <?, ? > table2IDCol ;
77+ private TableColumn <Part , Integer > table2IDCol ;
7778
7879 @ FXML
79- private TableColumn <?, ? > table2InvCol ;
80+ private TableColumn <Part , Integer > table2InvCol ;
8081
8182 @ FXML
82- private TableColumn <?, ? > table2NameCol ;
83+ private TableColumn <Part , String > table2NameCol ;
8384
8485 @ FXML
85- private TableColumn <?, ? > table2PriceCol ;
86+ private TableColumn <Part , Double > table2PriceCol ;
8687
8788 @ FXML
8889 void onActionCancel (ActionEvent event ) throws IOException {
@@ -91,6 +92,20 @@ void onActionCancel(ActionEvent event) throws IOException {
9192 stage .setScene (new Scene (scene ));
9293 stage .show ();
9394 }
95+ @ FXML
96+ void onActionSave (ActionEvent event ) throws IOException {
97+ int id = Integer .parseInt (productIDText .getText ());
98+ String name = productNameText .getText ();
99+ int inv = Integer .parseInt (inventoryText .getText ());
100+ double price = Double .parseDouble (priceText .getText ());
101+ int max = Integer .parseInt (maxText .getText ());
102+ int min = Integer .parseInt (minText .getText ());
103+
104+ stage = (Stage )((Button )event .getSource ()).getScene ().getWindow ();
105+ scene = FXMLLoader .load (Objects .requireNonNull (getClass ().getResource ("MainWindow.fxml" )));
106+ stage .setScene (new Scene (scene ));
107+ stage .show ();
108+ }
94109
95110 @ Override
96111 public void initialize (URL url , ResourceBundle resourceBundle ) {
0 commit comments