-
Notifications
You must be signed in to change notification settings - Fork 0
/
pg4controller.java
73 lines (48 loc) · 1.47 KB
/
pg4controller.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package application;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.TextField;
public class pg4controller implements Initializable {
@FXML
TextField nameTF;
@FXML
TextField idTF;
@FXML
TextField quantityTF;
@FXML
TextField priceTF;
@FXML
TextField brandTF;
@FXML
public ChoiceBox<SubCategory> esub;
@FXML
public ChoiceBox<Size> size;
public void initialize (URL arg0,ResourceBundle arg1){
esub.getItems().addAll(SubCategory.values());
size.getItems().addAll(Size.values());}
// addProduct(String name, String id, int quantity,double price , String b, SubCategory sub, Size size)
@FXML
public void add(ActionEvent event){
String name = nameTF.getText();
String id=idTF.getText();
String brand=brandTF.getText();
double price;
price =Double.parseDouble(priceTF.getText());
//store.addProduct(name, id, quantity, price, exp, mfg);
int quantity;
quantity=Integer.parseInt(quantityTF.getText());
SubCategory e=esub.getValue();
Size s=size.getValue();
Main.b.addProduct(name, id, quantity, price, brand, e, s);
DataHandler.saveData(Main.b);
nameTF.setText(null);
idTF.setText(null);
priceTF.setText(null);
quantityTF.setText(null);
brandTF.setText(null);
}
}