/Users/johnr/Desktop/IA pdf Downloads/_New Projects Downloads May 7th/CS_IA copy_Nick/src/main/java/com/mycompany/mavenproject5/MainGUI.java |
1
2 nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
3 nbfs://nbhost/SystemFileSystem/Templates/GUIForms/Application.java
4
5 package com.mycompany.mavenproject5;
6
7 import java.awt.Point;
8 import java.awt.event.MouseAdapter;
9 import java.sql.Connection;
10 import java.sql.DriverManager;
11 import java.sql.PreparedStatement;
12 import java.sql.ResultSet;
13 import java.sql.SQLException;
14 import java.sql.Statement;
15 import java.util.logging.Level;
16 import java.util.logging.Logger;
17 import javax.swing.table.DefaultTableModel;
18 import java.awt.event.MouseEvent;
19 import java.time.LocalDate;
20 import java.util.LinkedList;
21 import javax.swing.JOptionPane;
22 import javax.swing.JTable;
23 import javax.swing.table.JTableHeader;
24
25
26
27
28 @author
29
30
31
32
33 public class MainGUI extends javax.swing.JFrame {
34
35
36
37
38 String dbUrl = "jdbc:mysql://localhost:3306/cs_ia";
39 String user = "root";
40 String pass = "ojdl2004";
41 Connection myConn;
42 Statement myStmt;
43 Statement myStmt2;
44 PreparedStatement myPreStmt;
45 ResultSet myRs;
46 ResultSet myRs2;
47 https://www.youtube.com/watch?v=7S_tz1z_5bA
48 https://www.youtube.com/watch?v=8-iQDUl10vM&list=PLEAQNNR8IlB4R7NfqBY1frapYo97L6fOQ
49
50
51
52 private String storageOrder = "name";
53 private String ingredientsOrder = "name";
54 private String recipesOrder = "name";
55 private String suggestionsOrder = "name";
56 private String expiredOrder = "expiration_date";
57 private String expiringOrder = "expiration_date";
58 private String storageFilter = "None";
59
60 private LocalDate date = java.time.LocalDate.now();
61
62
63 https://www.codejava.net/java-se/swing/how-to-handle-mouse-clicking-event-on-jtable-column-header
64 class TableHeaderMouseListener extends MouseAdapter {
65 private JTable GUITable;
66
67 private TableHeaderMouseListener(JTable GUITable){
68 this.GUITable = GUITable;
69 }
70
71 public void mouseClicked(MouseEvent evt) {
72 java.awt.Point point = evt.getPoint();
73 int column = GUITable.columnAtPoint(point);
74
75 String[] ingredientsOrders = {"name", "type"};
76 String[] storageOrders = {"name", "quantity", "expiration_date"};
77
78
79
80 if(GUITable == ingredientsTable || GUITable == ingredientsTable1 || GUITable == ingredientsTable2){
81 ingredientsOrder = ingredientsOrders[column];
82 }else{
83 storageOrder = storageOrders[column];
84 }
85
86
87 refreshAllGUITables();
88 }
89 }
90
91
92 public MainGUI() throws ClassNotFoundException{
93 initComponents();
94
95
96 https://www.codejava.net/java-se/swing/how-to-handle-mouse-clicking-event-on-jtable-column-header
97 JTableHeader fridge1Header = fridge1Table.getTableHeader();
98 JTableHeader fridge2Header = fridge2Table.getTableHeader();
99 JTableHeader freezer1Header = freezer1Table.getTableHeader();
100 JTableHeader freezer2Header = freezer2Table.getTableHeader();
101 JTableHeader ingredientsHeader = ingredientsTable.getTableHeader();
102 JTableHeader ingredientsHeader1 = ingredientsTable1.getTableHeader();
103 JTableHeader ingredientsHeader2 = ingredientsTable2.getTableHeader();
104 fridge1Header.addMouseListener(new TableHeaderMouseListener(fridge1Table));
105 fridge2Header.addMouseListener(new TableHeaderMouseListener(fridge2Table));
106 freezer1Header.addMouseListener(new TableHeaderMouseListener(freezer1Table));
107 freezer2Header.addMouseListener(new TableHeaderMouseListener(freezer2Table));
108 ingredientsHeader.addMouseListener(new TableHeaderMouseListener(ingredientsTable));
109 ingredientsHeader1.addMouseListener(new TableHeaderMouseListener(ingredientsTable1));
110 ingredientsHeader1.addMouseListener(new TableHeaderMouseListener(ingredientsTable2));
111
112
113 refreshSQLTables();
114 refreshAllGUITables();
115 }
116
117
118
119 public void refreshSQLTables(){
120 try{
121
122 myConn = DriverManager.getConnection(dbUrl, user, pass);
123 myStmt = myConn.createStatement();
124
125
126 String[] storages = {"cs_ia.fridge_1", "cs_ia.fridge_2", "cs_ia.freezer_1", "cs_ia.freezer_2"};
127 for(int i = 0; i < storages.length; i++){
128 myStmt.executeUpdate("DELETE FROM " + storages[i] + ";");
129
130 if(storageFilter.equalsIgnoreCase("None")){
131 addSQLIngredients(storages[i]);
132 addSQLCookedMeals(storages[i]);
133 addSQLBoughtMeals(storages[i]);
134 }else if(storageFilter.equalsIgnoreCase("Meals")){
135 addSQLCookedMeals(storages[i]);
136 addSQLBoughtMeals(storages[i]);
137 }else if(storageFilter.equalsIgnoreCase("Cooked Meals")){
138 addSQLCookedMeals(storages[i]);
139 }else if(storageFilter.equalsIgnoreCase("Bought Meals")){
140 addSQLBoughtMeals(storages[i]);
141 }else if(storageFilter.equalsIgnoreCase("Ingredients")){
142 addSQLIngredients(storages[i]);
143 }else{
144 addSQLFilteredIngredients(storages[i]);
145 }
146 }
147
148
149 myStmt.executeUpdate("DELETE FROM cs_ia.meal_suggestions;");
150 addToMealSuggestions();
151 myStmt.executeUpdate("DELETE FROM cs_ia.expired_foods;");
152 addToExpiredFoods();
153 myStmt.executeUpdate("DELETE FROM cs_ia.expiring_foods;");
154 addToExpiringFoods();
155
156 }catch(SQLException e){
157 e.printStackTrace();
158 }
159 }
160
161
162 public void refreshAllGUITables(){
163 refreshGUITable(fridge1Table, "cs_ia.fridge_1", storageOrder);
164 refreshGUITable(fridge2Table, "cs_ia.fridge_2", storageOrder);
165 refreshGUITable(freezer1Table, "cs_ia.freezer_1", storageOrder);
166 refreshGUITable(freezer2Table, "cs_ia.freezer_2", storageOrder);
167 refreshGUITable(ingredientsTable, "cs_ia.ingredient_bases", ingredientsOrder);
168 refreshGUITable(recipesTable, "cs_ia.recipes", recipesOrder);
169 refreshGUITable(suggestionsTable, "cs_ia.meal_suggestions", suggestionsOrder);
170 refreshGUITable(expiredTable, "cs_ia.expired_foods", expiredOrder);
171 refreshGUITable(expiringTable, "cs_ia.expiring_foods", expiringOrder);
172 }
173
174
175 public void refreshGUITable(javax.swing.JTable GUITable, String SQLTable, String order){
176 try{
177 myConn = DriverManager.getConnection(dbUrl, user, pass);
178 myStmt = myConn.createStatement();
179 myStmt2 = myConn.createStatement();
180 myRs = myStmt.executeQuery("SELECT * FROM " + SQLTable + " ORDER BY " + order);
181
182
183 DefaultTableModel tableModel = (DefaultTableModel)GUITable.getModel();
184 tableModel.setRowCount(0);
185
186
187 if(SQLTable.equals("cs_ia.ingredient_bases")){
188 while(myRs.next()){
189 String name = myRs.getString("name");
190 String type = myRs.getString("type");
191 String[] tableData = {name, type};
192 tableModel.addRow(tableData);
193 }
194 }else if(SQLTable.equals("cs_ia.recipes") || SQLTable.equals("cs_ia.meal_suggestions")){
195 while(myRs.next()){
196 String name = myRs.getString("name");
197
198 String ingredientIDs = myRs.getString("ingredients_list");
199 LinkedList<String> IDsList = new LinkedList<String>();
200
201
202 String ingredients = "";
203 String temp = "";
204
205
206
207 for(int i = 0; i < ingredientIDs.length(); i++){
208 if(ingredientIDs.charAt(i) != ','){
209 temp += ingredientIDs.charAt(i);
210 }else{
211 IDsList.add(temp);
212 temp = "";
213 }
214 }
215 IDsList.add(temp);
216
217
218 for(int i = 0; i < IDsList.size(); i++){
219 myRs2 = myStmt2.executeQuery("SELECT * FROM ingredient_bases WHERE ingredient_base_id = '" + IDsList.get(i) + "';");
220 myRs2.next();
221 ingredients += myRs2.getString("name");
222 ingredients += ", ";
223 }
224 ingredients = ingredients.substring(0, ingredients.length() -2);
225
226
227
228
229 String[] tableData = {name, ingredients};
230 tableModel.addRow(tableData);
231 }
232 }else if(tableModel.getColumnCount() == 3){
233 while(myRs.next()){
234 String name = myRs.getString("name");
235 String quantity = myRs.getString("quantity");
236 String daysLeft = myRs.getString("expiration_date");
237 String[] tableData = {name, quantity, daysLeft};
238 tableModel.addRow(tableData);
239 }
240 }
241
242 }catch(SQLException e){
243 e.printStackTrace();
244 }
245 }
246
247
248 public void addSQLIngredients(String storage) throws SQLException{
249 myConn = DriverManager.getConnection(dbUrl, user, pass);
250 myStmt = myConn.createStatement();
251
252 myStmt.executeUpdate("INSERT INTO " + storage +
253 " (name, quantity, expiration_date) " +
254 "SELECT name, quantity, expiration_date " +
255 "FROM ingredients " +
256 "INNER JOIN ingredient_bases " +
257 "ON ingredients.ingredient_base_id = ingredient_bases.ingredient_base_id " +
258 "WHERE storage = '" + storage + "';");
259 myStmt.executeUpdate("UPDATE " + storage +
260 " SET food_type = '1' " +
261 "WHERE food_type IS NULL;");
262
263
264 }
265
266
267 public void addSQLFilteredIngredients(String storage) throws SQLException{
268 myConn = DriverManager.getConnection(dbUrl, user, pass);
269 myStmt = myConn.createStatement();
270
271 myStmt.executeUpdate("INSERT INTO " + storage +
272 " (name, quantity, expiration_date) " +
273 "SELECT name, quantity, expiration_date " +
274 "FROM ingredients " +
275 "INNER JOIN ingredient_bases " +
276 "ON ingredients.ingredient_base_id = ingredient_bases.ingredient_base_id " +
277 "WHERE storage = '" + storage + "' AND type = '" + storageFilter + "';");
278 myStmt.executeUpdate("UPDATE " + storage +
279 " SET food_type = '1' " +
280 "WHERE food_type IS NULL;");
281 }
282
283
284 public void addSQLCookedMeals(String storage) throws SQLException{
285 myConn = DriverManager.getConnection(dbUrl, user, pass);
286 myStmt = myConn.createStatement();
287
288 myStmt.executeUpdate("INSERT INTO " + storage +
289 " (name, quantity, expiration_date) " +
290 "SELECT name, quantity, expiration_date " +
291 "FROM cooked_meals " +
292 "INNER JOIN recipes " +
293 "ON cooked_meals.recipe_id = recipes.recipe_id " +
294 "WHERE storage = '" + storage + "';");
295 myStmt.executeUpdate("UPDATE " + storage +
296 " SET food_type = '2' " +
297 "WHERE food_type IS NULL;");
298
299
300 }
301
302
303 public void addSQLBoughtMeals(String storage) throws SQLException{
304 myConn = DriverManager.getConnection(dbUrl, user, pass);
305 myStmt = myConn.createStatement();
306
307 myStmt.executeUpdate("INSERT INTO " + storage +
308 " (name, quantity, expiration_date) " +
309 "SELECT name, quantity, expiration_date " +
310 "FROM bought_meals " +
311 "WHERE storage = '" + storage + "';");
312 myStmt.executeUpdate("UPDATE " + storage +
313 " SET food_type = '3' " +
314 "WHERE food_type IS NULL;");
315
316 }
317
318
319 public void addToMealSuggestions() throws SQLException{
320 myConn = DriverManager.getConnection(dbUrl, user, pass);
321 myStmt = myConn.createStatement();
322 myStmt2 = myConn.createStatement();
323 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.recipes;");
324
325 LinkedList<String> recipeIDs = new LinkedList<String>();
326
327 while(myRs.next()){
328 String ingredientIDs = myRs.getString("ingredients_list");
329
330
331 LinkedList<String> IDsList = new LinkedList<String>();
332 String temp = "";
333
334
335
336 for(int i = 0; i < ingredientIDs.length(); i++){
337 if(ingredientIDs.charAt(i) != ','){
338 temp += ingredientIDs.charAt(i);
339 }else{
340 IDsList.add(temp);
341 temp = "";
342 }
343 }
344 IDsList.add(temp);
345
346 boolean ingredientsAvailable = true;
347
348
349 for(int i = 0; i < IDsList.size(); i++){
350 myRs2 = myStmt2.executeQuery("SELECT * FROM cs_ia.ingredients");
351 boolean found = false;
352 while(myRs2.next()){
353 if(IDsList.get(i).equals(myRs2.getString("ingredient_base_id"))){
354 found = true;
355 }
356 }
357
358 if(!found){
359 ingredientsAvailable = false;
360 }
361 }
362
363
364 if(ingredientsAvailable){
365 recipeIDs.add(myRs.getString("recipe_id"));
366 }
367 }
368
369
370 for(int i = 0; i < recipeIDs.size(); i++){
371 myStmt.executeUpdate("INSERT INTO cs_ia.meal_suggestions" +
372 " (name, ingredients_list) " +
373 "SELECT name, ingredients_list " +
374 "FROM recipes " +
375 "WHERE recipe_id = '" + recipeIDs.get(i) + "';");
376 }
377 }
378
379
380 public void addToExpiredFoods(){
381 try{
382 myConn = DriverManager.getConnection(dbUrl, user, pass);
383 myStmt = myConn.createStatement();
384 myStmt2 = myConn.createStatement();
385
386
387
388 myStmt2.executeUpdate("INSERT INTO cs_ia.expired_foods" +
389 " (name, quantity, expiration_date) " +
390 "SELECT name, quantity, expiration_date " +
391 "FROM ingredients " +
392 "INNER JOIN ingredient_bases " +
393 "ON ingredients.ingredient_base_id = ingredient_bases.ingredient_base_id " +
394 "WHERE expiration_date <= '" + date + "';");
395 myStmt2.executeUpdate("UPDATE cs_ia.expired_foods" +
396 " SET food_type = '1' " +
397 "WHERE food_type IS NULL;");
398
399
400 myStmt.executeUpdate("INSERT INTO cs_ia.expired_foods" +
401 " (name, quantity, expiration_date) " +
402 "SELECT name, quantity, expiration_date " +
403 "FROM cooked_meals " +
404 "INNER JOIN recipes " +
405 "ON cooked_meals.recipe_id = recipes.recipe_id " +
406 "WHERE expiration_date <= '" + date + "';");
407 myStmt.executeUpdate("UPDATE cs_ia.expired_foods" +
408 " SET food_type = '2' " +
409 "WHERE food_type IS NULL;");
410
411 myStmt.executeUpdate("INSERT INTO cs_ia.expired_foods" +
412 " (name, quantity, expiration_date) " +
413 "SELECT name, quantity, expiration_date " +
414 "FROM bought_meals " +
415 "WHERE expiration_date <= '" + date + "';");
416 myStmt.executeUpdate("UPDATE cs_ia.expired_foods" +
417 " SET food_type = '3' " +
418 "WHERE food_type IS NULL;");
419 }catch(SQLException e){
420 e.printStackTrace();
421 }
422 }
423
424
425 public void addToExpiringFoods(){
426 try{
427 myConn = DriverManager.getConnection(dbUrl, user, pass);
428 myStmt = myConn.createStatement();
429 myStmt2 = myConn.createStatement();
430
431 LocalDate date2 = date.plusDays(3);
432
433
434
435
436 myStmt2.executeUpdate("INSERT INTO cs_ia.expiring_foods" +
437 " (name, quantity, expiration_date) " +
438 "SELECT name, quantity, expiration_date " +
439 "FROM ingredients " +
440 "INNER JOIN ingredient_bases " +
441 "ON ingredients.ingredient_base_id = ingredient_bases.ingredient_base_id " +
442 "WHERE expiration_date <= '" + date2 + "' AND expiration_date > '" + date + "';");
443 myStmt2.executeUpdate("UPDATE cs_ia.expiring_foods" +
444 " SET food_type = '1' " +
445 "WHERE food_type IS NULL;");
446
447 myStmt.executeUpdate("INSERT INTO cs_ia.expiring_foods" +
448 " (name, quantity, expiration_date) " +
449 "SELECT name, quantity, expiration_date " +
450 "FROM cooked_meals " +
451 "INNER JOIN recipes " +
452 "ON cooked_meals.recipe_id = recipes.recipe_id " +
453 "WHERE expiration_date <= '" + date2 + "' AND expiration_date > '" + date + "';");
454 myStmt.executeUpdate("UPDATE cs_ia.expiring_foods" +
455 " SET food_type = '2' " +
456 "WHERE food_type IS NULL;");
457
458 myStmt.executeUpdate("INSERT INTO cs_ia.expiring_foods" +
459 " (name, quantity, expiration_date) " +
460 "SELECT name, quantity, expiration_date " +
461 "FROM bought_meals " +
462 "WHERE expiration_date <= '" + date2 + "' AND expiration_date > '" + date + "';");
463 myStmt.executeUpdate("UPDATE cs_ia.expiring_foods" +
464 " SET food_type = '3' " +
465 "WHERE food_type IS NULL;");
466 }catch(SQLException e){
467 e.printStackTrace();
468 }
469 }
470
471
472
473 public void updateItemQuantity(javax.swing.JTable GUITable, String SQLTable, char change){
474 try{
475 myConn = DriverManager.getConnection(dbUrl, user, pass);
476 myStmt = myConn.createStatement();
477
478
479 int[] selectedRows = GUITable.getSelectedRows();
480 for(int i = 0; i < selectedRows.length; i++){
481 myRs = myStmt.executeQuery("SELECT * FROM " + SQLTable +
482 " WHERE (name = '" + GUITable.getValueAt(selectedRows[i], 0) + "')");
483 myRs.next();
484
485
486 if(myRs.getString("food_type").equals("1")){
487 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.ingredient_bases WHERE (name = '"
488 + GUITable.getValueAt(selectedRows[i], 0) + "')");
489 myRs.next();
490 myStmt.executeUpdate("UPDATE cs_ia.ingredients" +
491 " SET quantity = quantity " + change + " 1 WHERE (ingredient_base_id = '"
492 + myRs.getString("ingredient_base_id") + "')");
493 }else if(myRs.getString("food_type").equals("2")){
494 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.recipes WHERE (name = '"
495 + GUITable.getValueAt(selectedRows[i], 0) + "')");
496 myRs.next();
497 myStmt.executeUpdate("UPDATE cs_ia.cooked_meals" +
498 " SET quantity = quantity " + change + " 1 WHERE (recipe_id = '"
499 + myRs.getString("recipe_id") + "')");
500 }
501 else if(myRs.getString("food_type").equals("3")){
502 myStmt.executeUpdate("UPDATE cs_ia.bought_meals" +
503 " SET quantity = quantity " + change + " 1 WHERE (name = '"
504 + GUITable.getValueAt(selectedRows[i], 0) + "')");
505 }
506 }
507
508 refreshSQLTables();
509 refreshAllGUITables();
510 }catch(SQLException e){
511 e.printStackTrace();
512 }
513 }
514
515
516 public void deleteItem(javax.swing.JTable GUITable, String SQLTable){
517 try{
518 myConn = DriverManager.getConnection(dbUrl, user, pass);
519 myStmt = myConn.createStatement();
520
521
522 int[] selectedRows = GUITable.getSelectedRows();
523 for(int i = 0; i < selectedRows.length; i++){
524
525 if(SQLTable.equals("cs_ia.ingredient_bases") || SQLTable.equals("cs_ia.recipes")){
526 myStmt.executeUpdate("DELETE FROM " + SQLTable + " WHERE (name = '"
527 + GUITable.getValueAt(selectedRows[i], 0) + "')");
528 }else{
529 myRs = myStmt.executeQuery("SELECT * FROM " + SQLTable + " WHERE (name = '"
530 + GUITable.getValueAt(selectedRows[i], 0) + "')");
531 myRs.next();
532
533
534 if(myRs.getString("food_type").equals("1")){
535 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.ingredient_bases WHERE (name = '"
536 + GUITable.getValueAt(selectedRows[i], 0) + "')");
537 myRs.next();
538 myStmt.executeUpdate("DELETE FROM cs_ia.ingredients WHERE (ingredient_base_id = '"
539 + myRs.getString("ingredient_base_id") + "')");
540 }else if(myRs.getString("food_type").equals("2")){
541 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.recipes WHERE (name = '"
542 + GUITable.getValueAt(selectedRows[i], 0) + "')");
543 myRs.next();
544 myStmt.executeUpdate("DELETE FROM cs_ia.cooked_meals WHERE (recipes_id = '"
545 + myRs.getString("recipes_id") + "')");
546 }
547 else if(myRs.getString("food_type").equals("3")){
548 myStmt.executeUpdate("DELETE FROM cs_ia.bought_meals WHERE (name = '"
549 + GUITable.getValueAt(selectedRows[i], 0) + "')");
550 }
551 }
552 }
553
554 refreshSQLTables();
555 refreshAllGUITables();
556 }catch(SQLException e){
557 e.printStackTrace();
558 }
559 }
560
561
562 This method is called from within the constructor to initialize the form.
563
564
565
566 @SuppressWarnings("unchecked")
567 // <editor-fold defaultstate="collapsed" desc="Generated Code">
568 private void initComponents() {
569
570 createIngredientJD = new javax.swing.JDialog();
571 jLabel6 = new javax.swing.JLabel();
572 ingredientTF = new javax.swing.JTextField();
573 typeCB = new javax.swing.JComboBox<>();
574 jLabel30 = new javax.swing.JLabel();
575 cancelJB = new javax.swing.JButton();
576 addJB = new javax.swing.JButton();
577 jLabel8 = new javax.swing.JLabel();
578 editIngredientJD = new javax.swing.JDialog();
579 jLabel21 = new javax.swing.JLabel();
580 ingredientTF1 = new javax.swing.JTextField();
581 typeCB1 = new javax.swing.JComboBox<>();
582 jLabel31 = new javax.swing.JLabel();
583 cancelJB7 = new javax.swing.JButton();
584 saveJB = new javax.swing.JButton();
585 jLabel22 = new javax.swing.JLabel();
586 createRecipeJD = new javax.swing.JDialog();
587 jLabel11 = new javax.swing.JLabel();
588 jLabel7 = new javax.swing.JLabel();
589 recipeNameTF = new javax.swing.JTextField();
590 cancelJB1 = new javax.swing.JButton();
591 addJB1 = new javax.swing.JButton();
592 jLabel12 = new javax.swing.JLabel();
593 jScrollPane12 = new javax.swing.JScrollPane();
594 ingredientsTable1 = new javax.swing.JTable();
595 editRecipeJD = new javax.swing.JDialog();
596 jLabel25 = new javax.swing.JLabel();
597 jLabel10 = new javax.swing.JLabel();
598 recipeNameTF1 = new javax.swing.JTextField();
599 cancelJB8 = new javax.swing.JButton();
600 saveJB1 = new javax.swing.JButton();
601 jLabel26 = new javax.swing.JLabel();
602 jScrollPane14 = new javax.swing.JScrollPane();
603 ingredientsTable2 = new javax.swing.JTable();
604 addItemJD = new javax.swing.JDialog();
605 jLabel16 = new javax.swing.JLabel();
606 addIngredientJB = new javax.swing.JButton();
607 addCookedMealJB = new javax.swing.JButton();
608 addBoughtFoodJB = new javax.swing.JButton();
609 cancelJB4 = new javax.swing.JButton();
610 addBoughtFoodJD = new javax.swing.JDialog();
611 jLabel19 = new javax.swing.JLabel();
612 jLabel20 = new javax.swing.JLabel();
613 jLabel32 = new javax.swing.JLabel();
614 storageCB = new javax.swing.JComboBox<>();
615 cancelJB6 = new javax.swing.JButton();
616 addJB4 = new javax.swing.JButton();
617 jLabel33 = new javax.swing.JLabel();
618 quantityJS = new javax.swing.JSpinner();
619 jLabel34 = new javax.swing.JLabel();
620 dayJS = new javax.swing.JSpinner();
621 monthJS = new javax.swing.JSpinner();
622 yearJS = new javax.swing.JSpinner();
623 foodNameTF = new javax.swing.JTextField();
624 jLabel35 = new javax.swing.JLabel();
625 addIngredientJD = new javax.swing.JDialog();
626 jLabel23 = new javax.swing.JLabel();
627 jLabel36 = new javax.swing.JLabel();
628 storageCB1 = new javax.swing.JComboBox<>();
629 cancelJB9 = new javax.swing.JButton();
630 addJB5 = new javax.swing.JButton();
631 jLabel37 = new javax.swing.JLabel();
632 quantityJS1 = new javax.swing.JSpinner();
633 jLabel38 = new javax.swing.JLabel();
634 dayJS1 = new javax.swing.JSpinner();
635 monthJS1 = new javax.swing.JSpinner();
636 yearJS1 = new javax.swing.JSpinner();
637 jScrollPane13 = new javax.swing.JScrollPane();
638 ingredientsTable3 = new javax.swing.JTable();
639 jLabel13 = new javax.swing.JLabel();
640 jLabel39 = new javax.swing.JLabel();
641 addCookedMealJD = new javax.swing.JDialog();
642 jLabel24 = new javax.swing.JLabel();
643 jLabel40 = new javax.swing.JLabel();
644 storageCB2 = new javax.swing.JComboBox<>();
645 cancelJB10 = new javax.swing.JButton();
646 addJB6 = new javax.swing.JButton();
647 jLabel41 = new javax.swing.JLabel();
648 quantityJS2 = new javax.swing.JSpinner();
649 jLabel42 = new javax.swing.JLabel();
650 dayJS2 = new javax.swing.JSpinner();
651 monthJS2 = new javax.swing.JSpinner();
652 yearJS2 = new javax.swing.JSpinner();
653 jScrollPane15 = new javax.swing.JScrollPane();
654 recipeTable1 = new javax.swing.JTable();
655 jLabel14 = new javax.swing.JLabel();
656 jLabel43 = new javax.swing.JLabel();
657 editBoughtFoodJD = new javax.swing.JDialog();
658 jLabel27 = new javax.swing.JLabel();
659 jLabel28 = new javax.swing.JLabel();
660 jLabel44 = new javax.swing.JLabel();
661 storageCB3 = new javax.swing.JComboBox<>();
662 cancelJB11 = new javax.swing.JButton();
663 saveJB2 = new javax.swing.JButton();
664 jLabel45 = new javax.swing.JLabel();
665 quantityJS3 = new javax.swing.JSpinner();
666 jLabel46 = new javax.swing.JLabel();
667 dayJS3 = new javax.swing.JSpinner();
668 monthJS3 = new javax.swing.JSpinner();
669 yearJS3 = new javax.swing.JSpinner();
670 foodNameTF1 = new javax.swing.JTextField();
671 jLabel47 = new javax.swing.JLabel();
672 jTabbedPane1 = new javax.swing.JTabbedPane();
673 jPanel1 = new javax.swing.JPanel();
674 jScrollPane1 = new javax.swing.JScrollPane();
675 expiredTable = new javax.swing.JTable();
676 jScrollPane2 = new javax.swing.JScrollPane();
677 expiringTable = new javax.swing.JTable();
678 jScrollPane3 = new javax.swing.JScrollPane();
679 suggestionsTable = new javax.swing.JTable();
680 jLabel = new javax.swing.JLabel();
681 jLabel1 = new javax.swing.JLabel();
682 jLabel2 = new javax.swing.JLabel();
683 jPanel2 = new javax.swing.JPanel();
684 jScrollPane4 = new javax.swing.JScrollPane();
685 fridge1Table = new javax.swing.JTable();
686 jScrollPane5 = new javax.swing.JScrollPane();
687 freezer1Table = new javax.swing.JTable();
688 jScrollPane6 = new javax.swing.JScrollPane();
689 fridge2Table = new javax.swing.JTable();
690 jScrollPane7 = new javax.swing.JScrollPane();
691 freezer2Table = new javax.swing.JTable();
692 jLabel3 = new javax.swing.JLabel();
693 jLabel4 = new javax.swing.JLabel();
694 jLabel5 = new javax.swing.JLabel();
695 jLabel15 = new javax.swing.JLabel();
696 jLabel17 = new javax.swing.JLabel();
697 filterCB = new javax.swing.JComboBox<>();
698 addItemJB2 = new javax.swing.JButton();
699 deleteJB = new javax.swing.JButton();
700 editJB = new javax.swing.JButton();
701 plusJB = new javax.swing.JButton();
702 minusJB = new javax.swing.JButton();
703 jPanel3 = new javax.swing.JPanel();
704 jLabel18 = new javax.swing.JLabel();
705 jScrollPane8 = new javax.swing.JScrollPane();
706 recipesTable = new javax.swing.JTable();
707 createRecipeJB = new javax.swing.JButton();
708 createIngredientJB = new javax.swing.JButton();
709 jLabel29 = new javax.swing.JLabel();
710 jScrollPane9 = new javax.swing.JScrollPane();
711 ingredientsTable = new javax.swing.JTable();
712 editJB1 = new javax.swing.JButton();
713 deleteJB2 = new javax.swing.JButton();
714 menuBar = new javax.swing.JMenuBar();
715 fileMenu = new javax.swing.JMenu();
716 openMenuItem = new javax.swing.JMenuItem();
717 saveMenuItem = new javax.swing.JMenuItem();
718 saveAsMenuItem = new javax.swing.JMenuItem();
719 exitMenuItem = new javax.swing.JMenuItem();
720 editMenu = new javax.swing.JMenu();
721 cutMenuItem = new javax.swing.JMenuItem();
722 copyMenuItem = new javax.swing.JMenuItem();
723 pasteMenuItem = new javax.swing.JMenuItem();
724 deleteMenuItem = new javax.swing.JMenuItem();
725 helpMenu = new javax.swing.JMenu();
726 contentsMenuItem = new javax.swing.JMenuItem();
727 aboutMenuItem = new javax.swing.JMenuItem();
728
729 jLabel6.setText("Ingredient Name");
730
731 typeCB.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "SELECT TYPE", "Meat", "Vegetable", "Dairy", "Grain", "Fruit", "Sweet", "Other" }));
732
733 jLabel30.setText("Type:");
734
735 cancelJB.setText("Cancel");
736 cancelJB.addMouseListener(new java.awt.event.MouseAdapter() {
737 public void mouseReleased(java.awt.event.MouseEvent evt) {
738 cancelJBMouseReleased(evt);
739 }
740 });
741
742 addJB.setText("Add");
743 addJB.addMouseListener(new java.awt.event.MouseAdapter() {
744 public void mouseReleased(java.awt.event.MouseEvent evt) {
745 addJBMouseReleased(evt);
746 }
747 });
748 addJB.addActionListener(new java.awt.event.ActionListener() {
749 public void actionPerformed(java.awt.event.ActionEvent evt) {
750 addJBActionPerformed(evt);
751 }
752 });
753
754 jLabel8.setText("Create Ingredient");
755
756 javax.swing.GroupLayout createIngredientJDLayout = new javax.swing.GroupLayout(createIngredientJD.getContentPane());
757 createIngredientJD.getContentPane().setLayout(createIngredientJDLayout);
758 createIngredientJDLayout.setHorizontalGroup(
759 createIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
760 .addGroup(createIngredientJDLayout.createSequentialGroup()
761 .addContainerGap(41, Short.MAX_VALUE)
762 .addGroup(createIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
763 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, createIngredientJDLayout.createSequentialGroup()
764 .addGroup(createIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
765 .addGroup(createIngredientJDLayout.createSequentialGroup()
766 .addGap(54, 54, 54)
767 .addComponent(jLabel30)
768 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
769 .addComponent(typeCB, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
770 .addGroup(createIngredientJDLayout.createSequentialGroup()
771 .addComponent(jLabel6)
772 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
773 .addGroup(createIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
774 .addComponent(jLabel8)
775 .addComponent(ingredientTF, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE))))
776 .addGap(38, 38, 38))
777 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, createIngredientJDLayout.createSequentialGroup()
778 .addComponent(cancelJB)
779 .addGap(36, 36, 36)
780 .addComponent(addJB)
781 .addGap(102, 102, 102))))
782 );
783 createIngredientJDLayout.setVerticalGroup(
784 createIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
785 .addGroup(createIngredientJDLayout.createSequentialGroup()
786 .addGap(48, 48, 48)
787 .addComponent(jLabel8)
788 .addGap(32, 32, 32)
789 .addGroup(createIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
790 .addComponent(jLabel6)
791 .addComponent(ingredientTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
792 .addGap(29, 29, 29)
793 .addGroup(createIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
794 .addComponent(typeCB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
795 .addComponent(jLabel30))
796 .addGap(30, 30, 30)
797 .addGroup(createIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
798 .addComponent(cancelJB)
799 .addComponent(addJB))
800 .addContainerGap(63, Short.MAX_VALUE))
801 );
802
803 jLabel21.setText("Ingredient Name");
804
805 typeCB1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Meat", "Vegetable", "Dairy", "Grain", "Fruit", "Sweet", "Other" }));
806
807 jLabel31.setText("Type:");
808
809 cancelJB7.setText("Cancel");
810 cancelJB7.addMouseListener(new java.awt.event.MouseAdapter() {
811 public void mouseReleased(java.awt.event.MouseEvent evt) {
812 cancelJB7MouseReleased(evt);
813 }
814 });
815
816 saveJB.setText("Save");
817 saveJB.addMouseListener(new java.awt.event.MouseAdapter() {
818 public void mouseReleased(java.awt.event.MouseEvent evt) {
819 saveJBMouseReleased(evt);
820 }
821 });
822 saveJB.addActionListener(new java.awt.event.ActionListener() {
823 public void actionPerformed(java.awt.event.ActionEvent evt) {
824 saveJBActionPerformed(evt);
825 }
826 });
827
828 jLabel22.setText("Edit Ingredient");
829
830 javax.swing.GroupLayout editIngredientJDLayout = new javax.swing.GroupLayout(editIngredientJD.getContentPane());
831 editIngredientJD.getContentPane().setLayout(editIngredientJDLayout);
832 editIngredientJDLayout.setHorizontalGroup(
833 editIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
834 .addGroup(editIngredientJDLayout.createSequentialGroup()
835 .addContainerGap(41, Short.MAX_VALUE)
836 .addGroup(editIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
837 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editIngredientJDLayout.createSequentialGroup()
838 .addGroup(editIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
839 .addGroup(editIngredientJDLayout.createSequentialGroup()
840 .addGap(54, 54, 54)
841 .addComponent(jLabel31)
842 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
843 .addComponent(typeCB1, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
844 .addGroup(editIngredientJDLayout.createSequentialGroup()
845 .addComponent(jLabel21)
846 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
847 .addGroup(editIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
848 .addComponent(ingredientTF1, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
849 .addGroup(editIngredientJDLayout.createSequentialGroup()
850 .addGap(11, 11, 11)
851 .addComponent(jLabel22)))))
852 .addGap(38, 38, 38))
853 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editIngredientJDLayout.createSequentialGroup()
854 .addComponent(cancelJB7)
855 .addGap(36, 36, 36)
856 .addComponent(saveJB)
857 .addGap(102, 102, 102))))
858 );
859 editIngredientJDLayout.setVerticalGroup(
860 editIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
861 .addGroup(editIngredientJDLayout.createSequentialGroup()
862 .addGap(48, 48, 48)
863 .addComponent(jLabel22)
864 .addGap(32, 32, 32)
865 .addGroup(editIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
866 .addComponent(jLabel21)
867 .addComponent(ingredientTF1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
868 .addGap(29, 29, 29)
869 .addGroup(editIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
870 .addComponent(typeCB1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
871 .addComponent(jLabel31))
872 .addGap(30, 30, 30)
873 .addGroup(editIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
874 .addComponent(cancelJB7)
875 .addComponent(saveJB))
876 .addContainerGap(63, Short.MAX_VALUE))
877 );
878
879 jLabel11.setText("Create Recipe");
880
881 jLabel7.setText("Recipe Name");
882
883 cancelJB1.setText("Cancel");
884 cancelJB1.addMouseListener(new java.awt.event.MouseAdapter() {
885 public void mouseReleased(java.awt.event.MouseEvent evt) {
886 cancelJB1MouseReleased(evt);
887 }
888 });
889
890 addJB1.setText("Add");
891 addJB1.addMouseListener(new java.awt.event.MouseAdapter() {
892 public void mouseReleased(java.awt.event.MouseEvent evt) {
893 addJB1MouseReleased(evt);
894 }
895 });
896 addJB1.addActionListener(new java.awt.event.ActionListener() {
897 public void actionPerformed(java.awt.event.ActionEvent evt) {
898 addJB1ActionPerformed(evt);
899 }
900 });
901
902 jLabel12.setText("Select Ingredients:");
903
904 ingredientsTable1.setModel(new javax.swing.table.DefaultTableModel(
905 new Object [][] {
906
907 },
908 new String [] {
909 "Name", "Type"
910 }
911 ) {
912 Class[] types = new Class [] {
913 java.lang.String.class, java.lang.String.class
914 };
915 boolean[] canEdit = new boolean [] {
916 false, false
917 };
918
919 public Class getColumnClass(int columnIndex) {
920 return types [columnIndex];
921 }
922
923 public boolean isCellEditable(int rowIndex, int columnIndex) {
924 return canEdit [columnIndex];
925 }
926 });
927 jScrollPane12.setViewportView(ingredientsTable1);
928
929 javax.swing.GroupLayout createRecipeJDLayout = new javax.swing.GroupLayout(createRecipeJD.getContentPane());
930 createRecipeJD.getContentPane().setLayout(createRecipeJDLayout);
931 createRecipeJDLayout.setHorizontalGroup(
932 createRecipeJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
933 .addGroup(createRecipeJDLayout.createSequentialGroup()
934 .addGroup(createRecipeJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
935 .addGroup(createRecipeJDLayout.createSequentialGroup()
936 .addGap(149, 149, 149)
937 .addComponent(jLabel11))
938 .addGroup(createRecipeJDLayout.createSequentialGroup()
939 .addGap(91, 91, 91)
940 .addComponent(cancelJB1)
941 .addGap(46, 46, 46)
942 .addComponent(addJB1)))
943 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
944 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, createRecipeJDLayout.createSequentialGroup()
945 .addGap(0, 32, Short.MAX_VALUE)
946 .addGroup(createRecipeJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
947 .addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)
948 .addComponent(jLabel12)
949 .addGroup(createRecipeJDLayout.createSequentialGroup()
950 .addComponent(jLabel7)
951 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
952 .addComponent(recipeNameTF)))
953 .addGap(32, 32, 32))
954 );
955 createRecipeJDLayout.setVerticalGroup(
956 createRecipeJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
957 .addGroup(createRecipeJDLayout.createSequentialGroup()
958 .addGap(32, 32, 32)
959 .addComponent(jLabel11)
960 .addGap(27, 27, 27)
961 .addGroup(createRecipeJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
962 .addComponent(jLabel7)
963 .addComponent(recipeNameTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
964 .addGap(26, 26, 26)
965 .addComponent(jLabel12)
966 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
967 .addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
968 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
969 .addGroup(createRecipeJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
970 .addComponent(cancelJB1)
971 .addComponent(addJB1))
972 .addGap(32, 32, 32))
973 );
974
975 jLabel25.setText("Edit Recipe");
976
977 jLabel10.setText("Recipe Name");
978
979 cancelJB8.setText("Cancel");
980 cancelJB8.addMouseListener(new java.awt.event.MouseAdapter() {
981 public void mouseReleased(java.awt.event.MouseEvent evt) {
982 cancelJB8MouseReleased(evt);
983 }
984 });
985
986 saveJB1.setText("Save");
987 saveJB1.addMouseListener(new java.awt.event.MouseAdapter() {
988 public void mouseReleased(java.awt.event.MouseEvent evt) {
989 saveJB1MouseReleased(evt);
990 }
991 });
992 saveJB1.addActionListener(new java.awt.event.ActionListener() {
993 public void actionPerformed(java.awt.event.ActionEvent evt) {
994 saveJB1ActionPerformed(evt);
995 }
996 });
997
998 jLabel26.setText("Select Ingredients:");
999
1000 ingredientsTable2.setModel(new javax.swing.table.DefaultTableModel(
1001 new Object [][] {
1002
1003 },
1004 new String [] {
1005 "Name", "Type"
1006 }
1007 ) {
1008 Class[] types = new Class [] {
1009 java.lang.String.class, java.lang.String.class
1010 };
1011 boolean[] canEdit = new boolean [] {
1012 false, false
1013 };
1014
1015 public Class getColumnClass(int columnIndex) {
1016 return types [columnIndex];
1017 }
1018
1019 public boolean isCellEditable(int rowIndex, int columnIndex) {
1020 return canEdit [columnIndex];
1021 }
1022 });
1023 jScrollPane14.setViewportView(ingredientsTable2);
1024
1025 javax.swing.GroupLayout editRecipeJDLayout = new javax.swing.GroupLayout(editRecipeJD.getContentPane());
1026 editRecipeJD.getContentPane().setLayout(editRecipeJDLayout);
1027 editRecipeJDLayout.setHorizontalGroup(
1028 editRecipeJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1029 .addGroup(editRecipeJDLayout.createSequentialGroup()
1030 .addGap(91, 91, 91)
1031 .addComponent(cancelJB8)
1032 .addGap(46, 46, 46)
1033 .addComponent(saveJB1)
1034 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
1035 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editRecipeJDLayout.createSequentialGroup()
1036 .addGap(0, 32, Short.MAX_VALUE)
1037 .addGroup(editRecipeJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
1038 .addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)
1039 .addComponent(jLabel26)
1040 .addGroup(editRecipeJDLayout.createSequentialGroup()
1041 .addComponent(jLabel10)
1042 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1043 .addComponent(recipeNameTF1)))
1044 .addGap(32, 32, 32))
1045 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editRecipeJDLayout.createSequentialGroup()
1046 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1047 .addComponent(jLabel25)
1048 .addGap(153, 153, 153))
1049 );
1050 editRecipeJDLayout.setVerticalGroup(
1051 editRecipeJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1052 .addGroup(editRecipeJDLayout.createSequentialGroup()
1053 .addGap(32, 32, 32)
1054 .addComponent(jLabel25)
1055 .addGap(27, 27, 27)
1056 .addGroup(editRecipeJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1057 .addComponent(jLabel10)
1058 .addComponent(recipeNameTF1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1059 .addGap(26, 26, 26)
1060 .addComponent(jLabel26)
1061 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1062 .addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
1063 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
1064 .addGroup(editRecipeJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1065 .addComponent(cancelJB8)
1066 .addComponent(saveJB1))
1067 .addGap(32, 32, 32))
1068 );
1069
1070 addItemJD.setTitle("Add Item");
1071
1072 jLabel16.setText("Add Item");
1073
1074 addIngredientJB.setText("Add Ingredient");
1075 addIngredientJB.addMouseListener(new java.awt.event.MouseAdapter() {
1076 public void mouseReleased(java.awt.event.MouseEvent evt) {
1077 addIngredientJBMouseReleased(evt);
1078 }
1079 });
1080
1081 addCookedMealJB.setText("Add Cooked Meal");
1082 addCookedMealJB.addMouseListener(new java.awt.event.MouseAdapter() {
1083 public void mouseReleased(java.awt.event.MouseEvent evt) {
1084 addCookedMealJBMouseReleased(evt);
1085 }
1086 });
1087
1088 addBoughtFoodJB.setText("Add Bought Food");
1089 addBoughtFoodJB.addMouseListener(new java.awt.event.MouseAdapter() {
1090 public void mouseReleased(java.awt.event.MouseEvent evt) {
1091 addBoughtFoodJBMouseReleased(evt);
1092 }
1093 });
1094 addBoughtFoodJB.addActionListener(new java.awt.event.ActionListener() {
1095 public void actionPerformed(java.awt.event.ActionEvent evt) {
1096 addBoughtFoodJBActionPerformed(evt);
1097 }
1098 });
1099
1100 cancelJB4.setText("Cancel");
1101 cancelJB4.addMouseListener(new java.awt.event.MouseAdapter() {
1102 public void mouseReleased(java.awt.event.MouseEvent evt) {
1103 cancelJB4MouseReleased(evt);
1104 }
1105 });
1106
1107 javax.swing.GroupLayout addItemJDLayout = new javax.swing.GroupLayout(addItemJD.getContentPane());
1108 addItemJD.getContentPane().setLayout(addItemJDLayout);
1109 addItemJDLayout.setHorizontalGroup(
1110 addItemJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1111 .addGroup(addItemJDLayout.createSequentialGroup()
1112 .addGroup(addItemJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1113 .addGroup(addItemJDLayout.createSequentialGroup()
1114 .addGap(162, 162, 162)
1115 .addComponent(jLabel16))
1116 .addGroup(addItemJDLayout.createSequentialGroup()
1117 .addGap(122, 122, 122)
1118 .addGroup(addItemJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1119 .addGroup(addItemJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
1120 .addComponent(addBoughtFoodJB)
1121 .addGroup(addItemJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1122 .addGroup(addItemJDLayout.createSequentialGroup()
1123 .addGap(9, 9, 9)
1124 .addComponent(addIngredientJB))
1125 .addComponent(addCookedMealJB)))
1126 .addGroup(addItemJDLayout.createSequentialGroup()
1127 .addGap(33, 33, 33)
1128 .addComponent(cancelJB4)))))
1129 .addContainerGap(123, Short.MAX_VALUE))
1130 );
1131 addItemJDLayout.setVerticalGroup(
1132 addItemJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1133 .addGroup(addItemJDLayout.createSequentialGroup()
1134 .addGap(41, 41, 41)
1135 .addComponent(jLabel16)
1136 .addGap(27, 27, 27)
1137 .addComponent(addIngredientJB)
1138 .addGap(18, 18, 18)
1139 .addComponent(addCookedMealJB)
1140 .addGap(18, 18, 18)
1141 .addComponent(addBoughtFoodJB)
1142 .addGap(18, 18, 18)
1143 .addComponent(cancelJB4)
1144 .addContainerGap(46, Short.MAX_VALUE))
1145 );
1146
1147 jLabel19.setText("Add Bought Food");
1148
1149 jLabel20.setText("Food Name");
1150
1151 jLabel32.setText("Storage:");
1152
1153 storageCB.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "SELECT", "Fridge 1", "Fridge 2", "Freezer 1", "Freezer 2" }));
1154
1155 cancelJB6.setText("Cancel");
1156 cancelJB6.addMouseListener(new java.awt.event.MouseAdapter() {
1157 public void mouseReleased(java.awt.event.MouseEvent evt) {
1158 cancelJB6MouseReleased(evt);
1159 }
1160 });
1161
1162 addJB4.setText("Add");
1163 addJB4.addMouseListener(new java.awt.event.MouseAdapter() {
1164 public void mouseReleased(java.awt.event.MouseEvent evt) {
1165 addJB4MouseReleased(evt);
1166 }
1167 });
1168 addJB4.addActionListener(new java.awt.event.ActionListener() {
1169 public void actionPerformed(java.awt.event.ActionEvent evt) {
1170 addJB4ActionPerformed(evt);
1171 }
1172 });
1173
1174 jLabel33.setText("Quantity:");
1175
1176 jLabel34.setText("Expiration:");
1177
1178 jLabel35.setFont(new java.awt.Font("Helvetica Neue", 0, 9)); // NOI18N
1179 jLabel35.setText(" YY MM DD");
1180
1181 javax.swing.GroupLayout addBoughtFoodJDLayout = new javax.swing.GroupLayout(addBoughtFoodJD.getContentPane());
1182 addBoughtFoodJD.getContentPane().setLayout(addBoughtFoodJDLayout);
1183 addBoughtFoodJDLayout.setHorizontalGroup(
1184 addBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1185 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addBoughtFoodJDLayout.createSequentialGroup()
1186 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1187 .addComponent(cancelJB6)
1188 .addGap(57, 57, 57)
1189 .addComponent(addJB4)
1190 .addGap(79, 79, 79))
1191 .addGroup(addBoughtFoodJDLayout.createSequentialGroup()
1192 .addGroup(addBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1193 .addGroup(addBoughtFoodJDLayout.createSequentialGroup()
1194 .addGap(55, 55, 55)
1195 .addGroup(addBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1196 .addGroup(addBoughtFoodJDLayout.createSequentialGroup()
1197 .addComponent(jLabel20)
1198 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1199 .addComponent(foodNameTF, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
1200 .addGroup(addBoughtFoodJDLayout.createSequentialGroup()
1201 .addGroup(addBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1202 .addComponent(jLabel34)
1203 .addComponent(jLabel32)
1204 .addComponent(jLabel33))
1205 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
1206 .addGroup(addBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1207 .addComponent(storageCB, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
1208 .addComponent(jLabel35)
1209 .addComponent(quantityJS, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
1210 .addGroup(addBoughtFoodJDLayout.createSequentialGroup()
1211 .addComponent(yearJS, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
1212 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1213 .addComponent(monthJS, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
1214 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1215 .addComponent(dayJS, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))))))
1216 .addGroup(addBoughtFoodJDLayout.createSequentialGroup()
1217 .addGap(132, 132, 132)
1218 .addComponent(jLabel19)))
1219 .addContainerGap(57, Short.MAX_VALUE))
1220 );
1221 addBoughtFoodJDLayout.setVerticalGroup(
1222 addBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1223 .addGroup(addBoughtFoodJDLayout.createSequentialGroup()
1224 .addGap(45, 45, 45)
1225 .addComponent(jLabel19)
1226 .addGap(36, 36, 36)
1227 .addGroup(addBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1228 .addComponent(jLabel20)
1229 .addComponent(foodNameTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1230 .addGap(28, 28, 28)
1231 .addGroup(addBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1232 .addComponent(jLabel33)
1233 .addComponent(quantityJS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1234 .addGap(32, 32, 32)
1235 .addGroup(addBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1236 .addComponent(storageCB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1237 .addComponent(jLabel32))
1238 .addGap(27, 27, 27)
1239 .addGroup(addBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1240 .addComponent(jLabel34)
1241 .addComponent(dayJS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1242 .addComponent(yearJS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1243 .addComponent(monthJS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1244 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1245 .addComponent(jLabel35)
1246 .addGap(33, 33, 33)
1247 .addGroup(addBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1248 .addComponent(cancelJB6)
1249 .addComponent(addJB4))
1250 .addContainerGap(43, Short.MAX_VALUE))
1251 );
1252
1253 jLabel23.setText("Add Ingredient");
1254
1255 jLabel36.setText("Storage:");
1256
1257 storageCB1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "SELECT", "Fridge 1", "Fridge 2", "Freezer 1", "Freezer 2" }));
1258
1259 cancelJB9.setText("Cancel");
1260 cancelJB9.addMouseListener(new java.awt.event.MouseAdapter() {
1261 public void mouseReleased(java.awt.event.MouseEvent evt) {
1262 cancelJB9MouseReleased(evt);
1263 }
1264 });
1265
1266 addJB5.setText("Add");
1267 addJB5.addMouseListener(new java.awt.event.MouseAdapter() {
1268 public void mouseReleased(java.awt.event.MouseEvent evt) {
1269 addJB5MouseReleased(evt);
1270 }
1271 });
1272 addJB5.addActionListener(new java.awt.event.ActionListener() {
1273 public void actionPerformed(java.awt.event.ActionEvent evt) {
1274 addJB5ActionPerformed(evt);
1275 }
1276 });
1277
1278 jLabel37.setText("Quantity:");
1279
1280 jLabel38.setText("Expiration:");
1281
1282 ingredientsTable3.setModel(new javax.swing.table.DefaultTableModel(
1283 new Object [][] {
1284
1285 },
1286 new String [] {
1287 "Name", "Type"
1288 }
1289 ) {
1290 Class[] types = new Class [] {
1291 java.lang.String.class, java.lang.String.class
1292 };
1293 boolean[] canEdit = new boolean [] {
1294 false, false
1295 };
1296
1297 public Class getColumnClass(int columnIndex) {
1298 return types [columnIndex];
1299 }
1300
1301 public boolean isCellEditable(int rowIndex, int columnIndex) {
1302 return canEdit [columnIndex];
1303 }
1304 });
1305 jScrollPane13.setViewportView(ingredientsTable3);
1306
1307 jLabel13.setText("Select Ingredient:");
1308
1309 jLabel39.setFont(new java.awt.Font("Helvetica Neue", 0, 9)); // NOI18N
1310 jLabel39.setText(" YY MM DD");
1311
1312 javax.swing.GroupLayout addIngredientJDLayout = new javax.swing.GroupLayout(addIngredientJD.getContentPane());
1313 addIngredientJD.getContentPane().setLayout(addIngredientJDLayout);
1314 addIngredientJDLayout.setHorizontalGroup(
1315 addIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1316 .addGroup(addIngredientJDLayout.createSequentialGroup()
1317 .addGroup(addIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1318 .addGroup(addIngredientJDLayout.createSequentialGroup()
1319 .addGap(51, 51, 51)
1320 .addGroup(addIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1321 .addComponent(jLabel13)
1322 .addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 258, javax.swing.GroupLayout.PREFERRED_SIZE))
1323 .addGap(33, 33, 33)
1324 .addGroup(addIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
1325 .addGroup(addIngredientJDLayout.createSequentialGroup()
1326 .addGroup(addIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1327 .addComponent(jLabel38)
1328 .addComponent(jLabel36)
1329 .addComponent(jLabel37))
1330 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
1331 .addGroup(addIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1332 .addComponent(storageCB1, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
1333 .addComponent(quantityJS1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
1334 .addGroup(addIngredientJDLayout.createSequentialGroup()
1335 .addComponent(yearJS1, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
1336 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1337 .addComponent(monthJS1, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
1338 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1339 .addComponent(dayJS1, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))
1340 .addComponent(jLabel39)))
1341 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addIngredientJDLayout.createSequentialGroup()
1342 .addGap(26, 26, 26)
1343 .addComponent(cancelJB9)
1344 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1345 .addComponent(addJB5)
1346 .addGap(20, 20, 20))))
1347 .addGroup(addIngredientJDLayout.createSequentialGroup()
1348 .addGap(277, 277, 277)
1349 .addComponent(jLabel23)))
1350 .addContainerGap(47, Short.MAX_VALUE))
1351 );
1352 addIngredientJDLayout.setVerticalGroup(
1353 addIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1354 .addGroup(addIngredientJDLayout.createSequentialGroup()
1355 .addGap(42, 42, 42)
1356 .addComponent(jLabel23)
1357 .addGap(38, 38, 38)
1358 .addGroup(addIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
1359 .addGroup(addIngredientJDLayout.createSequentialGroup()
1360 .addComponent(jLabel13)
1361 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1362 .addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
1363 .addGroup(addIngredientJDLayout.createSequentialGroup()
1364 .addGroup(addIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1365 .addComponent(jLabel37)
1366 .addComponent(quantityJS1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1367 .addGap(32, 32, 32)
1368 .addGroup(addIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1369 .addComponent(storageCB1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1370 .addComponent(jLabel36))
1371 .addGap(27, 27, 27)
1372 .addGroup(addIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1373 .addComponent(jLabel38)
1374 .addComponent(yearJS1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1375 .addComponent(monthJS1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1376 .addComponent(dayJS1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1377 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1378 .addComponent(jLabel39)
1379 .addGap(33, 33, 33)
1380 .addGroup(addIngredientJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1381 .addComponent(cancelJB9)
1382 .addComponent(addJB5))))
1383 .addContainerGap(56, Short.MAX_VALUE))
1384 );
1385
1386 jLabel24.setText("Add Cooked Meal");
1387
1388 jLabel40.setText("Storage:");
1389
1390 storageCB2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "SELECT", "Fridge 1", "Fridge 2", "Freezer 1", "Freezer 2" }));
1391
1392 cancelJB10.setText("Cancel");
1393 cancelJB10.addMouseListener(new java.awt.event.MouseAdapter() {
1394 public void mouseReleased(java.awt.event.MouseEvent evt) {
1395 cancelJB10MouseReleased(evt);
1396 }
1397 });
1398
1399 addJB6.setText("Add");
1400 addJB6.addMouseListener(new java.awt.event.MouseAdapter() {
1401 public void mouseReleased(java.awt.event.MouseEvent evt) {
1402 addJB6MouseReleased(evt);
1403 }
1404 });
1405 addJB6.addActionListener(new java.awt.event.ActionListener() {
1406 public void actionPerformed(java.awt.event.ActionEvent evt) {
1407 addJB6ActionPerformed(evt);
1408 }
1409 });
1410
1411 jLabel41.setText("Quantity:");
1412
1413 jLabel42.setText("Expiration:");
1414
1415 recipeTable1.setModel(new javax.swing.table.DefaultTableModel(
1416 new Object [][] {
1417
1418 },
1419 new String [] {
1420 "Name", "Type"
1421 }
1422 ) {
1423 Class[] types = new Class [] {
1424 java.lang.String.class, java.lang.String.class
1425 };
1426 boolean[] canEdit = new boolean [] {
1427 false, false
1428 };
1429
1430 public Class getColumnClass(int columnIndex) {
1431 return types [columnIndex];
1432 }
1433
1434 public boolean isCellEditable(int rowIndex, int columnIndex) {
1435 return canEdit [columnIndex];
1436 }
1437 });
1438 jScrollPane15.setViewportView(recipeTable1);
1439
1440 jLabel14.setText("Select Recipe:");
1441
1442 jLabel43.setFont(new java.awt.Font("Helvetica Neue", 0, 9)); // NOI18N
1443 jLabel43.setText(" YY MM DD");
1444
1445 javax.swing.GroupLayout addCookedMealJDLayout = new javax.swing.GroupLayout(addCookedMealJD.getContentPane());
1446 addCookedMealJD.getContentPane().setLayout(addCookedMealJDLayout);
1447 addCookedMealJDLayout.setHorizontalGroup(
1448 addCookedMealJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1449 .addGroup(addCookedMealJDLayout.createSequentialGroup()
1450 .addGroup(addCookedMealJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1451 .addGroup(addCookedMealJDLayout.createSequentialGroup()
1452 .addGap(51, 51, 51)
1453 .addGroup(addCookedMealJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1454 .addComponent(jLabel14)
1455 .addComponent(jScrollPane15, javax.swing.GroupLayout.PREFERRED_SIZE, 258, javax.swing.GroupLayout.PREFERRED_SIZE))
1456 .addGap(33, 33, 33)
1457 .addGroup(addCookedMealJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
1458 .addGroup(addCookedMealJDLayout.createSequentialGroup()
1459 .addGroup(addCookedMealJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1460 .addComponent(jLabel42)
1461 .addComponent(jLabel40)
1462 .addComponent(jLabel41))
1463 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
1464 .addGroup(addCookedMealJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1465 .addComponent(storageCB2, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
1466 .addComponent(quantityJS2, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
1467 .addGroup(addCookedMealJDLayout.createSequentialGroup()
1468 .addComponent(yearJS2, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
1469 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1470 .addComponent(monthJS2, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
1471 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1472 .addComponent(dayJS2, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))
1473 .addComponent(jLabel43)))
1474 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addCookedMealJDLayout.createSequentialGroup()
1475 .addGap(26, 26, 26)
1476 .addComponent(cancelJB10)
1477 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1478 .addComponent(addJB6)
1479 .addGap(20, 20, 20))))
1480 .addGroup(addCookedMealJDLayout.createSequentialGroup()
1481 .addGap(267, 267, 267)
1482 .addComponent(jLabel24)))
1483 .addContainerGap(47, Short.MAX_VALUE))
1484 );
1485 addCookedMealJDLayout.setVerticalGroup(
1486 addCookedMealJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1487 .addGroup(addCookedMealJDLayout.createSequentialGroup()
1488 .addGap(42, 42, 42)
1489 .addComponent(jLabel24)
1490 .addGap(38, 38, 38)
1491 .addGroup(addCookedMealJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
1492 .addGroup(addCookedMealJDLayout.createSequentialGroup()
1493 .addComponent(jLabel14)
1494 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1495 .addComponent(jScrollPane15, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
1496 .addGroup(addCookedMealJDLayout.createSequentialGroup()
1497 .addGroup(addCookedMealJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1498 .addComponent(jLabel41)
1499 .addComponent(quantityJS2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1500 .addGap(32, 32, 32)
1501 .addGroup(addCookedMealJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1502 .addComponent(storageCB2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1503 .addComponent(jLabel40))
1504 .addGap(27, 27, 27)
1505 .addGroup(addCookedMealJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1506 .addComponent(jLabel42)
1507 .addComponent(yearJS2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1508 .addComponent(monthJS2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1509 .addComponent(dayJS2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1510 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1511 .addComponent(jLabel43)
1512 .addGap(33, 33, 33)
1513 .addGroup(addCookedMealJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1514 .addComponent(cancelJB10)
1515 .addComponent(addJB6))))
1516 .addContainerGap(56, Short.MAX_VALUE))
1517 );
1518
1519 jLabel27.setText("Edit Bought Food");
1520
1521 jLabel28.setText("Food Name");
1522
1523 jLabel44.setText("Storage:");
1524
1525 storageCB3.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "SELECT", "Fridge 1", "Fridge 2", "Freezer 1", "Freezer 2" }));
1526
1527 cancelJB11.setText("Cancel");
1528 cancelJB11.addMouseListener(new java.awt.event.MouseAdapter() {
1529 public void mouseReleased(java.awt.event.MouseEvent evt) {
1530 cancelJB11MouseReleased(evt);
1531 }
1532 });
1533
1534 saveJB2.setText("Save");
1535 saveJB2.addMouseListener(new java.awt.event.MouseAdapter() {
1536 public void mouseReleased(java.awt.event.MouseEvent evt) {
1537 saveJB2MouseReleased(evt);
1538 }
1539 });
1540 saveJB2.addActionListener(new java.awt.event.ActionListener() {
1541 public void actionPerformed(java.awt.event.ActionEvent evt) {
1542 saveJB2ActionPerformed(evt);
1543 }
1544 });
1545
1546 jLabel45.setText("Quantity:");
1547
1548 jLabel46.setText("Expiration:");
1549
1550 jLabel47.setFont(new java.awt.Font("Helvetica Neue", 0, 9)); // NOI18N
1551 jLabel47.setText(" YY MM DD");
1552
1553 javax.swing.GroupLayout editBoughtFoodJDLayout = new javax.swing.GroupLayout(editBoughtFoodJD.getContentPane());
1554 editBoughtFoodJD.getContentPane().setLayout(editBoughtFoodJDLayout);
1555 editBoughtFoodJDLayout.setHorizontalGroup(
1556 editBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1557 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editBoughtFoodJDLayout.createSequentialGroup()
1558 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1559 .addComponent(cancelJB11)
1560 .addGap(57, 57, 57)
1561 .addComponent(saveJB2)
1562 .addGap(79, 79, 79))
1563 .addGroup(editBoughtFoodJDLayout.createSequentialGroup()
1564 .addGroup(editBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1565 .addGroup(editBoughtFoodJDLayout.createSequentialGroup()
1566 .addGap(55, 55, 55)
1567 .addGroup(editBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1568 .addGroup(editBoughtFoodJDLayout.createSequentialGroup()
1569 .addComponent(jLabel28)
1570 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1571 .addComponent(foodNameTF1, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
1572 .addGroup(editBoughtFoodJDLayout.createSequentialGroup()
1573 .addGroup(editBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1574 .addComponent(jLabel46)
1575 .addComponent(jLabel44)
1576 .addComponent(jLabel45))
1577 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
1578 .addGroup(editBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1579 .addComponent(storageCB3, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
1580 .addComponent(jLabel47)
1581 .addComponent(quantityJS3, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
1582 .addGroup(editBoughtFoodJDLayout.createSequentialGroup()
1583 .addComponent(yearJS3, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
1584 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1585 .addComponent(monthJS3, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
1586 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1587 .addComponent(dayJS3, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))))))
1588 .addGroup(editBoughtFoodJDLayout.createSequentialGroup()
1589 .addGap(132, 132, 132)
1590 .addComponent(jLabel27)))
1591 .addContainerGap(57, Short.MAX_VALUE))
1592 );
1593 editBoughtFoodJDLayout.setVerticalGroup(
1594 editBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1595 .addGroup(editBoughtFoodJDLayout.createSequentialGroup()
1596 .addGap(45, 45, 45)
1597 .addComponent(jLabel27)
1598 .addGap(36, 36, 36)
1599 .addGroup(editBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1600 .addComponent(jLabel28)
1601 .addComponent(foodNameTF1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1602 .addGap(28, 28, 28)
1603 .addGroup(editBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1604 .addComponent(jLabel45)
1605 .addComponent(quantityJS3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1606 .addGap(32, 32, 32)
1607 .addGroup(editBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1608 .addComponent(storageCB3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1609 .addComponent(jLabel44))
1610 .addGap(27, 27, 27)
1611 .addGroup(editBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1612 .addComponent(jLabel46)
1613 .addComponent(dayJS3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1614 .addComponent(yearJS3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1615 .addComponent(monthJS3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1616 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1617 .addComponent(jLabel47)
1618 .addGap(33, 33, 33)
1619 .addGroup(editBoughtFoodJDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1620 .addComponent(cancelJB11)
1621 .addComponent(saveJB2))
1622 .addContainerGap(43, Short.MAX_VALUE))
1623 );
1624
1625 setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
1626
1627 expiredTable.setModel(new javax.swing.table.DefaultTableModel(
1628 new Object [][] {
1629
1630 },
1631 new String [] {
1632 "Name", "Quantity", "Expiration"
1633 }
1634 ) {
1635 Class[] types = new Class [] {
1636 java.lang.String.class, java.lang.Integer.class, java.lang.String.class
1637 };
1638 boolean[] canEdit = new boolean [] {
1639 false, false, false
1640 };
1641
1642 public Class getColumnClass(int columnIndex) {
1643 return types [columnIndex];
1644 }
1645
1646 public boolean isCellEditable(int rowIndex, int columnIndex) {
1647 return canEdit [columnIndex];
1648 }
1649 });
1650 jScrollPane1.setViewportView(expiredTable);
1651
1652 expiringTable.setModel(new javax.swing.table.DefaultTableModel(
1653 new Object [][] {
1654
1655 },
1656 new String [] {
1657 "Name", "Quantity", "Expiration"
1658 }
1659 ) {
1660 Class[] types = new Class [] {
1661 java.lang.String.class, java.lang.Integer.class, java.lang.String.class
1662 };
1663 boolean[] canEdit = new boolean [] {
1664 false, false, false
1665 };
1666
1667 public Class getColumnClass(int columnIndex) {
1668 return types [columnIndex];
1669 }
1670
1671 public boolean isCellEditable(int rowIndex, int columnIndex) {
1672 return canEdit [columnIndex];
1673 }
1674 });
1675 jScrollPane2.setViewportView(expiringTable);
1676
1677 suggestionsTable.setModel(new javax.swing.table.DefaultTableModel(
1678 new Object [][] {
1679
1680 },
1681 new String [] {
1682 "Name", "Ingredients"
1683 }
1684 ) {
1685 Class[] types = new Class [] {
1686 java.lang.String.class, java.lang.String.class
1687 };
1688 boolean[] canEdit = new boolean [] {
1689 false, false
1690 };
1691
1692 public Class getColumnClass(int columnIndex) {
1693 return types [columnIndex];
1694 }
1695
1696 public boolean isCellEditable(int rowIndex, int columnIndex) {
1697 return canEdit [columnIndex];
1698 }
1699 });
1700 suggestionsTable.setGridColor(new java.awt.Color(0, 0, 0));
1701 jScrollPane3.setViewportView(suggestionsTable);
1702
1703 jLabel.setText("Expired Foods");
1704
1705 jLabel1.setText("Expiring Foods");
1706
1707 jLabel2.setText("Suggested Meals to Cook");
1708
1709 javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
1710 jPanel1.setLayout(jPanel1Layout);
1711 jPanel1Layout.setHorizontalGroup(
1712 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1713 .addGroup(jPanel1Layout.createSequentialGroup()
1714 .addGap(58, 58, 58)
1715 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1716 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)
1717 .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)
1718 .addComponent(jLabel)
1719 .addComponent(jLabel1))
1720 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 91, Short.MAX_VALUE)
1721 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1722 .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)
1723 .addComponent(jLabel2))
1724 .addGap(61, 61, 61))
1725 );
1726 jPanel1Layout.setVerticalGroup(
1727 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1728 .addGroup(jPanel1Layout.createSequentialGroup()
1729 .addGap(70, 70, 70)
1730 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1731 .addComponent(jLabel)
1732 .addComponent(jLabel2))
1733 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1734 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
1735 .addGroup(jPanel1Layout.createSequentialGroup()
1736 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE)
1737 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
1738 .addComponent(jLabel1)
1739 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1740 .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE))
1741 .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 445, javax.swing.GroupLayout.PREFERRED_SIZE))
1742 .addContainerGap(82, Short.MAX_VALUE))
1743 );
1744
1745 jTabbedPane1.addTab("Home", jPanel1);
1746
1747 fridge1Table.setModel(new javax.swing.table.DefaultTableModel(
1748 new Object [][] {
1749
1750 },
1751 new String [] {
1752 "Name", "Quantity", "Expiration"
1753 }
1754 ) {
1755 Class[] types = new Class [] {
1756 java.lang.String.class, java.lang.Integer.class, java.lang.String.class
1757 };
1758 boolean[] canEdit = new boolean [] {
1759 false, false, false
1760 };
1761
1762 public Class getColumnClass(int columnIndex) {
1763 return types [columnIndex];
1764 }
1765
1766 public boolean isCellEditable(int rowIndex, int columnIndex) {
1767 return canEdit [columnIndex];
1768 }
1769 });
1770 fridge1Table.addMouseListener(new java.awt.event.MouseAdapter() {
1771 public void mouseReleased(java.awt.event.MouseEvent evt) {
1772 fridge1TableMouseReleased(evt);
1773 }
1774 });
1775 jScrollPane4.setViewportView(fridge1Table);
1776
1777 freezer1Table.setModel(new javax.swing.table.DefaultTableModel(
1778 new Object [][] {
1779
1780 },
1781 new String [] {
1782 "Name", "Quantity", "Expiration"
1783 }
1784 ) {
1785 Class[] types = new Class [] {
1786 java.lang.String.class, java.lang.Integer.class, java.lang.String.class
1787 };
1788 boolean[] canEdit = new boolean [] {
1789 false, false, false
1790 };
1791
1792 public Class getColumnClass(int columnIndex) {
1793 return types [columnIndex];
1794 }
1795
1796 public boolean isCellEditable(int rowIndex, int columnIndex) {
1797 return canEdit [columnIndex];
1798 }
1799 });
1800 jScrollPane5.setViewportView(freezer1Table);
1801
1802 fridge2Table.setModel(new javax.swing.table.DefaultTableModel(
1803 new Object [][] {
1804
1805 },
1806 new String [] {
1807 "Name", "Quantity", "Expiration"
1808 }
1809 ) {
1810 Class[] types = new Class [] {
1811 java.lang.String.class, java.lang.Integer.class, java.lang.String.class
1812 };
1813 boolean[] canEdit = new boolean [] {
1814 false, false, false
1815 };
1816
1817 public Class getColumnClass(int columnIndex) {
1818 return types [columnIndex];
1819 }
1820
1821 public boolean isCellEditable(int rowIndex, int columnIndex) {
1822 return canEdit [columnIndex];
1823 }
1824 });
1825 jScrollPane6.setViewportView(fridge2Table);
1826
1827 freezer2Table.setModel(new javax.swing.table.DefaultTableModel(
1828 new Object [][] {
1829
1830 },
1831 new String [] {
1832 "Name", "Quantity", "Expiration"
1833 }
1834 ) {
1835 Class[] types = new Class [] {
1836 java.lang.String.class, java.lang.Integer.class, java.lang.String.class
1837 };
1838 boolean[] canEdit = new boolean [] {
1839 false, false, false
1840 };
1841
1842 public Class getColumnClass(int columnIndex) {
1843 return types [columnIndex];
1844 }
1845
1846 public boolean isCellEditable(int rowIndex, int columnIndex) {
1847 return canEdit [columnIndex];
1848 }
1849 });
1850 jScrollPane7.setViewportView(freezer2Table);
1851
1852 jLabel3.setText("Fridge 2");
1853
1854 jLabel4.setText("Freezer 1");
1855
1856 jLabel5.setText("Freezer 2");
1857
1858 jLabel15.setText("Fridge 1");
1859
1860 jLabel17.setText("Filter:");
1861
1862 filterCB.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "None", "Meals", "Cooked Meals", "Bought Meals", "Ingredients", "Meat", "Vegetables", "Dairy", "Grains", "Fruits", "Sweets", "Other" }));
1863 filterCB.addItemListener(new java.awt.event.ItemListener() {
1864 public void itemStateChanged(java.awt.event.ItemEvent evt) {
1865 filterCBItemStateChanged(evt);
1866 }
1867 });
1868 filterCB.addActionListener(new java.awt.event.ActionListener() {
1869 public void actionPerformed(java.awt.event.ActionEvent evt) {
1870 filterCBActionPerformed(evt);
1871 }
1872 });
1873 filterCB.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
1874 public void propertyChange(java.beans.PropertyChangeEvent evt) {
1875 filterCBPropertyChange(evt);
1876 }
1877 });
1878
1879 addItemJB2.setText("Add New Item");
1880 addItemJB2.addMouseListener(new java.awt.event.MouseAdapter() {
1881 public void mouseReleased(java.awt.event.MouseEvent evt) {
1882 addItemJB2MouseReleased(evt);
1883 }
1884 });
1885 addItemJB2.addActionListener(new java.awt.event.ActionListener() {
1886 public void actionPerformed(java.awt.event.ActionEvent evt) {
1887 addItemJB2ActionPerformed(evt);
1888 }
1889 });
1890
1891 deleteJB.setText("Delete");
1892 deleteJB.addMouseListener(new java.awt.event.MouseAdapter() {
1893 public void mouseReleased(java.awt.event.MouseEvent evt) {
1894 deleteJBMouseReleased(evt);
1895 }
1896 });
1897
1898 editJB.setText("Edit");
1899 editJB.addMouseListener(new java.awt.event.MouseAdapter() {
1900 public void mouseReleased(java.awt.event.MouseEvent evt) {
1901 editJBMouseReleased(evt);
1902 }
1903 });
1904
1905 plusJB.setText("+");
1906 plusJB.addMouseListener(new java.awt.event.MouseAdapter() {
1907 public void mouseReleased(java.awt.event.MouseEvent evt) {
1908 plusJBMouseReleased(evt);
1909 }
1910 });
1911
1912 minusJB.setText("-");
1913 minusJB.addMouseListener(new java.awt.event.MouseAdapter() {
1914 public void mouseReleased(java.awt.event.MouseEvent evt) {
1915 minusJBMouseReleased(evt);
1916 }
1917 });
1918
1919 javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
1920 jPanel2.setLayout(jPanel2Layout);
1921 jPanel2Layout.setHorizontalGroup(
1922 jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1923 .addGroup(jPanel2Layout.createSequentialGroup()
1924 .addGap(63, 63, 63)
1925 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
1926 .addGroup(jPanel2Layout.createSequentialGroup()
1927 .addComponent(jLabel17)
1928 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
1929 .addComponent(filterCB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1930 .addGap(35, 35, 35)
1931 .addComponent(addItemJB2))
1932 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1933 .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)
1934 .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)
1935 .addComponent(jLabel4)
1936 .addComponent(jLabel15)))
1937 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66, Short.MAX_VALUE)
1938 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1939 .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)
1940 .addComponent(jLabel3)
1941 .addComponent(jLabel5)
1942 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
1943 .addGroup(jPanel2Layout.createSequentialGroup()
1944 .addComponent(deleteJB)
1945 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1946 .addComponent(minusJB)
1947 .addGap(18, 18, 18)
1948 .addComponent(editJB)
1949 .addGap(18, 18, 18)
1950 .addComponent(plusJB))
1951 .addComponent(jScrollPane6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)))
1952 .addGap(81, 81, 81))
1953 );
1954 jPanel2Layout.setVerticalGroup(
1955 jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1956 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
1957 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1958 .addGroup(jPanel2Layout.createSequentialGroup()
1959 .addGap(43, 43, 43)
1960 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1961 .addComponent(jLabel17)
1962 .addComponent(filterCB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1963 .addComponent(addItemJB2)))
1964 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
1965 .addContainerGap()
1966 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1967 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1968 .addComponent(editJB)
1969 .addComponent(plusJB)
1970 .addComponent(minusJB))
1971 .addComponent(deleteJB))))
1972 .addGap(18, 18, 18)
1973 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
1974 .addGroup(jPanel2Layout.createSequentialGroup()
1975 .addComponent(jLabel3)
1976 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1977 .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE)
1978 .addGap(22, 22, 22)
1979 .addComponent(jLabel5)
1980 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1981 .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE))
1982 .addGroup(jPanel2Layout.createSequentialGroup()
1983 .addComponent(jLabel15)
1984 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1985 .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE)
1986 .addGap(22, 22, 22)
1987 .addComponent(jLabel4)
1988 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1989 .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE)))
1990 .addContainerGap(58, Short.MAX_VALUE))
1991 );
1992
1993 jTabbedPane1.addTab("Storages", jPanel2);
1994
1995 jLabel18.setText("Recipes");
1996
1997 recipesTable.setModel(new javax.swing.table.DefaultTableModel(
1998 new Object [][] {
1999
2000 },
2001 new String [] {
2002 "Name", "Ingredients"
2003 }
2004 ) {
2005 Class[] types = new Class [] {
2006 java.lang.String.class, java.lang.String.class
2007 };
2008 boolean[] canEdit = new boolean [] {
2009 false, false
2010 };
2011
2012 public Class getColumnClass(int columnIndex) {
2013 return types [columnIndex];
2014 }
2015
2016 public boolean isCellEditable(int rowIndex, int columnIndex) {
2017 return canEdit [columnIndex];
2018 }
2019 });
2020 jScrollPane8.setViewportView(recipesTable);
2021
2022 createRecipeJB.setText("Create New Recipe");
2023 createRecipeJB.addMouseListener(new java.awt.event.MouseAdapter() {
2024 public void mouseReleased(java.awt.event.MouseEvent evt) {
2025 createRecipeJBMouseReleased(evt);
2026 }
2027 });
2028
2029 createIngredientJB.setText("Create New Ingredient");
2030 createIngredientJB.addMouseListener(new java.awt.event.MouseAdapter() {
2031 public void mouseReleased(java.awt.event.MouseEvent evt) {
2032 createIngredientJBMouseReleased(evt);
2033 }
2034 });
2035
2036 jLabel29.setText("Ingredients");
2037
2038 ingredientsTable.setModel(new javax.swing.table.DefaultTableModel(
2039 new Object [][] {
2040
2041 },
2042 new String [] {
2043 "Name", "Type"
2044 }
2045 ) {
2046 Class[] types = new Class [] {
2047 java.lang.String.class, java.lang.String.class
2048 };
2049 boolean[] canEdit = new boolean [] {
2050 false, false
2051 };
2052
2053 public Class getColumnClass(int columnIndex) {
2054 return types [columnIndex];
2055 }
2056
2057 public boolean isCellEditable(int rowIndex, int columnIndex) {
2058 return canEdit [columnIndex];
2059 }
2060 });
2061 jScrollPane9.setViewportView(ingredientsTable);
2062
2063 editJB1.setText("Edit");
2064 editJB1.addMouseListener(new java.awt.event.MouseAdapter() {
2065 public void mouseReleased(java.awt.event.MouseEvent evt) {
2066 editJB1MouseReleased(evt);
2067 }
2068 });
2069
2070 deleteJB2.setText("Delete");
2071 deleteJB2.addMouseListener(new java.awt.event.MouseAdapter() {
2072 public void mouseReleased(java.awt.event.MouseEvent evt) {
2073 deleteJB2MouseReleased(evt);
2074 }
2075 });
2076
2077 javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
2078 jPanel3.setLayout(jPanel3Layout);
2079 jPanel3Layout.setHorizontalGroup(
2080 jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
2081 .addGroup(jPanel3Layout.createSequentialGroup()
2082 .addGap(68, 68, 68)
2083 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
2084 .addGroup(jPanel3Layout.createSequentialGroup()
2085 .addComponent(createRecipeJB)
2086 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
2087 .addComponent(editJB1))
2088 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
2089 .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)
2090 .addComponent(jLabel18)))
2091 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 79, Short.MAX_VALUE)
2092 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
2093 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
2094 .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)
2095 .addComponent(jLabel29))
2096 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
2097 .addComponent(deleteJB2)
2098 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
2099 .addComponent(createIngredientJB)))
2100 .addGap(63, 63, 63))
2101 );
2102 jPanel3Layout.setVerticalGroup(
2103 jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
2104 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
2105 .addGap(49, 49, 49)
2106 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
2107 .addComponent(createRecipeJB)
2108 .addComponent(createIngredientJB)
2109 .addComponent(deleteJB2)
2110 .addComponent(editJB1))
2111 .addGap(18, 18, 18)
2112 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
2113 .addComponent(jLabel18)
2114 .addComponent(jLabel29))
2115 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
2116 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
2117 .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 444, Short.MAX_VALUE)
2118 .addComponent(jScrollPane9))
2119 .addContainerGap(63, Short.MAX_VALUE))
2120 );
2121
2122 jTabbedPane1.addTab("Recipes/Ingredients", jPanel3);
2123
2124 fileMenu.setMnemonic('f');
2125 fileMenu.setText("File");
2126
2127 openMenuItem.setMnemonic('o');
2128 openMenuItem.setText("Open");
2129 fileMenu.add(openMenuItem);
2130
2131 saveMenuItem.setMnemonic('s');
2132 saveMenuItem.setText("Save");
2133 fileMenu.add(saveMenuItem);
2134
2135 saveAsMenuItem.setMnemonic('a');
2136 saveAsMenuItem.setText("Save As ...");
2137 saveAsMenuItem.setDisplayedMnemonicIndex(5);
2138 fileMenu.add(saveAsMenuItem);
2139
2140 exitMenuItem.setMnemonic('x');
2141 exitMenuItem.setText("Exit");
2142 exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
2143 public void actionPerformed(java.awt.event.ActionEvent evt) {
2144 exitMenuItemActionPerformed(evt);
2145 }
2146 });
2147 fileMenu.add(exitMenuItem);
2148
2149 menuBar.add(fileMenu);
2150
2151 editMenu.setMnemonic('e');
2152 editMenu.setText("Edit");
2153
2154 cutMenuItem.setMnemonic('t');
2155 cutMenuItem.setText("Cut");
2156 editMenu.add(cutMenuItem);
2157
2158 copyMenuItem.setMnemonic('y');
2159 copyMenuItem.setText("Copy");
2160 editMenu.add(copyMenuItem);
2161
2162 pasteMenuItem.setMnemonic('p');
2163 pasteMenuItem.setText("Paste");
2164 editMenu.add(pasteMenuItem);
2165
2166 deleteMenuItem.setMnemonic('d');
2167 deleteMenuItem.setText("Delete");
2168 editMenu.add(deleteMenuItem);
2169
2170 menuBar.add(editMenu);
2171
2172 helpMenu.setMnemonic('h');
2173 helpMenu.setText("Help");
2174
2175 contentsMenuItem.setMnemonic('c');
2176 contentsMenuItem.setText("Contents");
2177 helpMenu.add(contentsMenuItem);
2178
2179 aboutMenuItem.setMnemonic('a');
2180 aboutMenuItem.setText("About");
2181 helpMenu.add(aboutMenuItem);
2182
2183 menuBar.add(helpMenu);
2184
2185 setJMenuBar(menuBar);
2186
2187 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
2188 getContentPane().setLayout(layout);
2189 layout.setHorizontalGroup(
2190 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
2191 .addGroup(layout.createSequentialGroup()
2192 .addContainerGap()
2193 .addComponent(jTabbedPane1)
2194 .addContainerGap())
2195 );
2196 layout.setVerticalGroup(
2197 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
2198 .addGroup(layout.createSequentialGroup()
2199 .addContainerGap()
2200 .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 650, Short.MAX_VALUE)
2201 .addContainerGap())
2202 );
2203
2204 pack();
2205 }// </editor-fold>
2206
2207 private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
2208 System.exit(0);
2209 }
2210
2211 private void filterCBActionPerformed(java.awt.event.ActionEvent evt) {
2212
2213 }
2214
2215 private void addJBActionPerformed(java.awt.event.ActionEvent evt) {
2216
2217 }
2218
2219 private void addJB1ActionPerformed(java.awt.event.ActionEvent evt) {
2220
2221 }
2222
2223 private void minusJBMouseReleased(java.awt.event.MouseEvent evt) {
2224 updateItemQuantity(fridge1Table, "cs_ia.fridge_1", '-');
2225 updateItemQuantity(fridge2Table, "cs_ia.fridge_2", '-');
2226 updateItemQuantity(freezer1Table, "cs_ia.freezer_1", '-');
2227 updateItemQuantity(freezer2Table, "cs_ia.freezer_2", '-');
2228 }
2229
2230 private void plusJBMouseReleased(java.awt.event.MouseEvent evt) {
2231 updateItemQuantity(fridge1Table, "cs_ia.fridge_1", '+');
2232 updateItemQuantity(fridge2Table, "cs_ia.fridge_2", '+');
2233 updateItemQuantity(freezer1Table, "cs_ia.freezer_1", '+');
2234 updateItemQuantity(freezer2Table, "cs_ia.freezer_2", '+');
2235 }
2236
2237 private void deleteJBMouseReleased(java.awt.event.MouseEvent evt) {
2238 deleteItem(fridge1Table, "cs_ia.fridge_1");
2239 deleteItem(fridge2Table, "cs_ia.fridge_2");
2240 deleteItem(freezer1Table, "cs_ia.freezer_1");
2241 deleteItem(freezer2Table, "cs_ia.freezer_2");
2242 }
2243
2244 private void addItemJB2MouseReleased(java.awt.event.MouseEvent evt) {
2245 addItemJD.setVisible(true);
2246 addItemJD.setBounds(500, 250, 380, 307);
2247 addItemJD.setAlwaysOnTop(true);
2248 }
2249
2250 private void addJB4ActionPerformed(java.awt.event.ActionEvent evt) {
2251
2252 }
2253
2254 private void createIngredientJBMouseReleased(java.awt.event.MouseEvent evt) {
2255 createIngredientJD.setVisible(true);
2256 createIngredientJD.setBounds(500, 250, 391, 318);
2257 createIngredientJD.setAlwaysOnTop(true);
2258 }
2259
2260 private void cancelJBMouseReleased(java.awt.event.MouseEvent evt) {
2261 ingredientTF.setText("");
2262 typeCB.setSelectedIndex(0);
2263 createIngredientJD.setVisible(false);
2264 }
2265
2266 private void addJBMouseReleased(java.awt.event.MouseEvent evt) {
2267 if(!ingredientTF.getText().equals("") && typeCB.getSelectedItem() != typeCB.getItemAt(0)){
2268 try{
2269 myConn = DriverManager.getConnection(dbUrl, user, pass);
2270 myStmt = myConn.createStatement();
2271 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.ingredient_bases");
2272
2273 boolean repeats = false;
2274 while(myRs.next()){
2275 if(myRs.getString("name").equals(ingredientTF.getText())){
2276 repeats = true;
2277 }
2278 }
2279
2280 if(!repeats){
2281 myStmt.executeUpdate("INSERT INTO cs_ia.ingredient_bases (name, type) VALUES ('"
2282 + ingredientTF.getText() + "', '" + typeCB.getSelectedItem() + "');");
2283 refreshGUITable(ingredientsTable, "cs_ia.ingredient_bases", ingredientsOrder);
2284 }else{
2285 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2286 JOptionPane.showMessageDialog(this, "An ingredient with this name already exists.");
2287 }
2288
2289 }catch(SQLException e){
2290 e.printStackTrace();
2291 }
2292
2293 ingredientTF.setText("");
2294 typeCB.setSelectedIndex(0);
2295 createIngredientJD.setVisible(false);
2296 }else{
2297 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2298 JOptionPane.showMessageDialog(this, "Please input an ingredient name and select a type.");
2299 }
2300 }
2301
2302 private void editJB1MouseReleased(java.awt.event.MouseEvent evt) {
2303 try{
2304 myConn = DriverManager.getConnection(dbUrl, user, pass);
2305 myStmt = myConn.createStatement();
2306
2307 int[] selectedRows1 = ingredientsTable.getSelectedRows();
2308 int[] selectedRows2 = recipesTable.getSelectedRows();
2309
2310 if(selectedRows1.length == 0 && selectedRows2.length == 0){
2311 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2312 JOptionPane.showMessageDialog(this, "Please select a row to edit.");
2313 }else if(selectedRows1.length == 1 && selectedRows2.length == 0){
2314 String name = (String) ingredientsTable.getValueAt(selectedRows1[0], 0);
2315 String type = (String) ingredientsTable.getValueAt(selectedRows1[0], 1);
2316
2317 editIngredientJD.setVisible(true);
2318 editIngredientJD.setBounds(500, 250, 391, 318);
2319 editIngredientJD.setAlwaysOnTop(true);
2320
2321 ingredientTF1.setText(name);
2322 typeCB1.setSelectedItem(type);
2323 }else if(selectedRows1.length == 0 && selectedRows2.length == 1){
2324 String name = (String) recipesTable.getValueAt(selectedRows2[0], 0);
2325 String ingredients = (String) recipesTable.getValueAt(selectedRows2[0], 1);
2326
2327 editRecipeJD.setVisible(true);
2328 editRecipeJD.setBounds(500, 250, 375, 473);
2329 editRecipeJD.setAlwaysOnTop(true);
2330
2331 recipeNameTF1.setText(name);
2332
2333 LinkedList<String> ingredientsList = new LinkedList<String>();
2334 String temp = "";
2335 int itemNum = 0;
2336 boolean manyItems = false;
2337 for(int i = 0; i < ingredients.length(); i++){
2338 if(ingredients.charAt(i) != ','){
2339 temp += ingredients.charAt(i);
2340 }else{
2341 if(temp.charAt(0) == ' '){
2342 temp = temp.substring(1, temp.length());
2343 }else{
2344 temp = temp.substring(0, temp.length());
2345 }
2346 ingredientsList.add(temp);
2347 itemNum++;
2348 temp = "";
2349 manyItems = true;
2350 }
2351 }
2352 itemNum++;
2353 if(manyItems){
2354 temp = temp.substring(1, temp.length());
2355 }
2356 ingredientsList.add(temp);
2357
2358 refreshGUITable(ingredientsTable2, "cs_ia.ingredient_bases", ingredientsOrder);
2359 for(int i = 0; i < itemNum; i++){
2360 for(int row = 0; row < ingredientsTable2.getRowCount(); row++){
2361 if(ingredientsList.get(i).equalsIgnoreCase((String) ingredientsTable2.getValueAt(row, 0))){
2362 ingredientsTable2.getSelectionModel().addSelectionInterval(row, row);
2363 }
2364 }
2365 }
2366 }else{
2367 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2368 JOptionPane.showMessageDialog(this, "Please only select one row from one table.");
2369 }
2370
2371 }catch(SQLException e){
2372 e.printStackTrace();
2373 }
2374
2375 refreshGUITable(ingredientsTable, "cs_ia.ingredient_bases", ingredientsOrder);
2376 }
2377
2378 private void deleteJB2MouseReleased(java.awt.event.MouseEvent evt) {
2379 deleteItem(ingredientsTable, "cs_ia.ingredient_bases");
2380 deleteItem(recipesTable, "cs_ia.recipes");
2381 }
2382
2383 private void filterCBPropertyChange(java.beans.PropertyChangeEvent evt) {
2384
2385 }
2386
2387 private void filterCBItemStateChanged(java.awt.event.ItemEvent evt) {
2388 storageFilter = (String) filterCB.getSelectedItem();
2389 refreshSQLTables();
2390 refreshAllGUITables();
2391 }
2392
2393 private void fridge1TableMouseReleased(java.awt.event.MouseEvent evt) {
2394 java.awt.Point point = evt.getPoint();
2395 int column = fridge1Table.columnAtPoint(point);
2396 int row = fridge1Table.rowAtPoint(point);
2397 }
2398
2399 private void createRecipeJBMouseReleased(java.awt.event.MouseEvent evt) {
2400 createRecipeJD.setVisible(true);
2401 createRecipeJD.setBounds(500, 250, 365, 473);
2402 createRecipeJD.setAlwaysOnTop(true);
2403 refreshGUITable(ingredientsTable1, "cs_ia.ingredient_bases", ingredientsOrder);
2404 }
2405
2406 private void cancelJB1MouseReleased(java.awt.event.MouseEvent evt) {
2407 recipeNameTF.setText("");
2408 ingredientsTable1.clearSelection();
2409 createRecipeJD.setVisible(false);
2410 }
2411
2412 private void addJB1MouseReleased(java.awt.event.MouseEvent evt) {
2413 if(!recipeNameTF.getText().equals("") && ingredientsTable1.getSelectedRowCount() != 0){
2414 try{
2415 myConn = DriverManager.getConnection(dbUrl, user, pass);
2416 myStmt = myConn.createStatement();
2417 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.recipes");
2418
2419 boolean repeats = false;
2420 while(myRs.next()){
2421 if(myRs.getString("name").equals(recipeNameTF.getText())){
2422 repeats = true;
2423 }
2424 }
2425
2426 if(!repeats){
2427 String ingredientsList = "";
2428
2429 int[] selectedRows = ingredientsTable1.getSelectedRows();
2430 for(int i = 0; i < ingredientsTable1.getSelectedRowCount(); i++){
2431 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.ingredient_bases WHERE name = '" + ingredientsTable1.getValueAt(selectedRows[i], 0) + "';");
2432 myRs.next();
2433 ingredientsList += myRs.getInt("ingredient_base_id");
2434 ingredientsList += ",";
2435 }
2436 ingredientsList = ingredientsList.substring(0, ingredientsList.length()-1);
2437
2438 myStmt.executeUpdate("INSERT INTO cs_ia.recipes (name, ingredients_list) VALUES ('" + recipeNameTF.getText() + "', '" + ingredientsList + "');");
2439 refreshGUITable(recipesTable, "cs_ia.recipes", recipesOrder);
2440 }else{
2441 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2442 JOptionPane.showMessageDialog(this, "A recipe with this name already exists.");
2443 }
2444
2445 }catch(SQLException e){
2446 e.printStackTrace();
2447 }
2448
2449 recipeNameTF.setText("");
2450 ingredientsTable1.clearSelection();
2451 createRecipeJD.setVisible(false);
2452 }else{
2453 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2454 JOptionPane.showMessageDialog(this, "Please input a recipe name and select at least one ingredient.");
2455 }
2456 }
2457
2458 private void saveJBActionPerformed(java.awt.event.ActionEvent evt) {
2459
2460 }
2461
2462 private void saveJBMouseReleased(java.awt.event.MouseEvent evt) {
2463 if(!ingredientTF1.getText().equals("") && typeCB1.getSelectedItem() != typeCB1.getItemAt(0)){
2464 try{
2465 myConn = DriverManager.getConnection(dbUrl, user, pass);
2466 myStmt = myConn.createStatement();
2467 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.ingredient_bases");
2468
2469 myStmt.executeUpdate("UPDATE cs_ia.ingredient_bases SET type = '" + typeCB1.getSelectedItem() + "' WHERE name = '" + ingredientTF1.getText() +"';");
2470 refreshGUITable(ingredientsTable, "cs_ia.ingredient_bases", ingredientsOrder);
2471 }catch(SQLException e){
2472 e.printStackTrace();
2473 }
2474
2475 ingredientTF1.setText("");
2476 typeCB1.setSelectedIndex(0);
2477 editIngredientJD.setVisible(false);
2478 }else{
2479 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2480 JOptionPane.showMessageDialog(this, "Please input an ingredient name and select a type.");
2481 }
2482 }
2483
2484 private void cancelJB7MouseReleased(java.awt.event.MouseEvent evt) {
2485 ingredientTF1.setText("");
2486 typeCB1.setSelectedIndex(0);
2487 editIngredientJD.setVisible(false);
2488 }
2489
2490 private void cancelJB8MouseReleased(java.awt.event.MouseEvent evt) {
2491 recipeNameTF1.setText("");
2492 ingredientsTable2.clearSelection();
2493 editRecipeJD.setVisible(false);
2494 }
2495
2496 private void saveJB1MouseReleased(java.awt.event.MouseEvent evt) {
2497 if(!recipeNameTF1.getText().equals("") && ingredientsTable2.getSelectedRowCount() != 0){
2498 try{
2499 myConn = DriverManager.getConnection(dbUrl, user, pass);
2500 myStmt = myConn.createStatement();
2501 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.recipes");
2502
2503 String ingredientsList = "";
2504
2505 int[] selectedRows = ingredientsTable2.getSelectedRows();
2506 for(int i = 0; i < ingredientsTable2.getSelectedRowCount(); i++){
2507 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.ingredient_bases WHERE name = '" + ingredientsTable2.getValueAt(selectedRows[i], 0) + "';");
2508 myRs.next();
2509 ingredientsList += myRs.getInt("ingredient_base_id");
2510 ingredientsList += ",";
2511 }
2512 ingredientsList = ingredientsList.substring(0, ingredientsList.length()-1);
2513
2514 String originalName = (String) recipesTable.getValueAt(recipesTable.getSelectedRow(), 0);
2515 myStmt.executeUpdate("UPDATE cs_ia.recipes SET name = '" + recipeNameTF1.getText() + "', ingredients_list = '" + ingredientsList + "' WHERE (name = '" + originalName + "');");
2516 refreshGUITable(recipesTable, "cs_ia.recipes", recipesOrder);
2517 }catch(SQLException e){
2518 e.printStackTrace();
2519 }
2520
2521 recipeNameTF1.setText("");
2522 ingredientsTable2.clearSelection();
2523 editRecipeJD.setVisible(false);
2524 }else{
2525 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2526 JOptionPane.showMessageDialog(this, "Please input a recipe name and select at least one ingredient.");
2527 }
2528 }
2529
2530 private void saveJB1ActionPerformed(java.awt.event.ActionEvent evt) {
2531
2532 }
2533
2534 private void addBoughtFoodJBMouseReleased(java.awt.event.MouseEvent evt) {
2535 addBoughtFoodJD.setVisible(true);
2536 addBoughtFoodJD.setBounds(500, 250, 363, 424);
2537 addBoughtFoodJD.setAlwaysOnTop(true);
2538 addItemJD.setVisible(false);
2539 }
2540
2541 private void cancelJB6MouseReleased(java.awt.event.MouseEvent evt) {
2542 foodNameTF.setText("");
2543 quantityJS.setValue(0);
2544 storageCB.setSelectedIndex(0);
2545 yearJS.setValue(0);
2546 monthJS.setValue(0);
2547 dayJS.setValue(0);
2548 addBoughtFoodJD.setVisible(false);
2549 }
2550
2551 private void cancelJB4MouseReleased(java.awt.event.MouseEvent evt) {
2552 addItemJD.setVisible(false);
2553 }
2554
2555 private void addBoughtFoodJBActionPerformed(java.awt.event.ActionEvent evt) {
2556
2557 }
2558
2559 private void addJB4MouseReleased(java.awt.event.MouseEvent evt) {
2560 if(!foodNameTF.getText().equals("") && (int) quantityJS.getValue() > 0 && storageCB.getSelectedIndex() != 0 && (int) yearJS.getValue() > 0 && (int) monthJS.getValue() > 0 && (int) dayJS.getValue() > 0){
2561 try{
2562 myConn = DriverManager.getConnection(dbUrl, user, pass);
2563 myStmt = myConn.createStatement();
2564 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.bought_meals");
2565
2566 boolean repeats = false;
2567 while(myRs.next()){
2568 if(myRs.getString("name").equals(foodNameTF.getText())){
2569 repeats = true;
2570 }
2571 }
2572
2573 if(!repeats){
2574 String date = "20";
2575 String temp = yearJS.getValue() + "";
2576 if(temp.length() == 1){
2577 date = "200";
2578 }
2579 date += yearJS.getValue() + "";
2580 temp = monthJS.getValue() + "";
2581 if(temp.length() == 1){
2582 temp = "0" + temp;
2583 }
2584 date += "-" + temp;
2585 temp = dayJS.getValue() + "";
2586 if(temp.length() == 1){
2587 temp = "0" + temp;
2588 }
2589 date += "-" + temp;
2590
2591 String storage = "";
2592 if(storageCB.getSelectedIndex() == 1){
2593 storage = "cs_ia.fridge_1";
2594 }else if(storageCB.getSelectedIndex() == 2){
2595 storage = "cs_ia.fridge_2";
2596 }else if(storageCB.getSelectedIndex() == 3){
2597 storage = "cs_ia.freezer_1";
2598 }else if(storageCB.getSelectedIndex() == 4){
2599 storage = "cs_ia.freezer_2";
2600 }
2601
2602 myStmt.executeUpdate("INSERT INTO cs_ia.bought_meals (name, quantity, expiration_date, storage) VALUES ('" + foodNameTF.getText() + "', '" + quantityJS.getValue() + "', '" + date + "', '" + storage + "');");
2603
2604 refreshSQLTables();
2605 refreshAllGUITables();
2606 }else{
2607 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2608 JOptionPane.showMessageDialog(this, "An item with this name already exists.");
2609 }
2610
2611
2612 }catch(SQLException e){
2613 e.printStackTrace();
2614 }
2615
2616 foodNameTF.setText("");
2617 quantityJS.setValue(0);
2618 storageCB.setSelectedIndex(0);
2619 yearJS.setValue(0);
2620 monthJS.setValue(0);
2621 dayJS.setValue(0);
2622 addBoughtFoodJD.setVisible(false);
2623 }else{
2624 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2625 JOptionPane.showMessageDialog(this, "Please input all values.");
2626 }
2627 }
2628
2629 private void cancelJB9MouseReleased(java.awt.event.MouseEvent evt) {
2630 ingredientsTable3.clearSelection();
2631 quantityJS1.setValue(0);
2632 storageCB1.setSelectedIndex(0);
2633 yearJS1.setValue(0);
2634 monthJS1.setValue(0);
2635 dayJS1.setValue(0);
2636 addIngredientJD.setVisible(false);
2637 }
2638
2639 private void addJB5MouseReleased(java.awt.event.MouseEvent evt) {
2640 if(ingredientsTable3.getSelectedRowCount() == 1 && (int) quantityJS1.getValue() > 0 && storageCB1.getSelectedIndex() != 0 && (int) yearJS1.getValue() > 0 && (int) monthJS1.getValue() > 0 && (int) dayJS1.getValue() > 0){
2641 try{
2642 myConn = DriverManager.getConnection(dbUrl, user, pass);
2643 myStmt = myConn.createStatement();
2644 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.ingredients");
2645
2646 String name = (String) ingredientsTable3.getValueAt(ingredientsTable3.getSelectedRow(), 0);
2647
2648 String date = "20";
2649 String temp = yearJS1.getValue() + "";
2650 if(temp.length() == 1){
2651 date = "200";
2652 }
2653 date += yearJS1.getValue() + "";
2654 temp = monthJS1.getValue() + "";
2655 if(temp.length() == 1){
2656 temp = "0" + temp;
2657 }
2658 date += "-" + temp;
2659 temp = dayJS1.getValue() + "";
2660 if(temp.length() == 1){
2661 temp = "0" + temp;
2662 }
2663 date += "-" + temp;
2664
2665 String storage = "";
2666 if(storageCB1.getSelectedIndex() == 1){
2667 storage = "cs_ia.fridge_1";
2668 }else if(storageCB1.getSelectedIndex() == 2){
2669 storage = "cs_ia.fridge_2";
2670 }else if(storageCB1.getSelectedIndex() == 3){
2671 storage = "cs_ia.freezer_1";
2672 }else if(storageCB1.getSelectedIndex() == 4){
2673 storage = "cs_ia.freezer_2";
2674 }
2675
2676 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.ingredient_bases WHERE (name = '" + name + "');");
2677 myRs.next();
2678
2679 myStmt.executeUpdate("INSERT INTO cs_ia.ingredients (ingredient_base_id, quantity, expiration_date, storage) VALUES ('" + myRs.getString("ingredient_base_id") + "', '" + quantityJS1.getValue() + "', '" + date + "', '" + storage + "');");
2680
2681 refreshSQLTables();
2682 refreshAllGUITables();
2683 }catch(SQLException e){
2684 e.printStackTrace();
2685 }
2686
2687 ingredientsTable3.clearSelection();
2688 quantityJS1.setValue(0);
2689 storageCB1.setSelectedIndex(0);
2690 yearJS1.setValue(0);
2691 monthJS1.setValue(0);
2692 dayJS1.setValue(0);
2693 addIngredientJD.setVisible(false);
2694 }else{
2695 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2696 JOptionPane.showMessageDialog(this, "Please input all values and select one row.");
2697 }
2698 }
2699
2700 private void addJB5ActionPerformed(java.awt.event.ActionEvent evt) {
2701
2702 }
2703
2704 private void addIngredientJBMouseReleased(java.awt.event.MouseEvent evt) {
2705 addIngredientJD.setVisible(true);
2706 addIngredientJD.setBounds(500, 250, 640, 385);
2707 addIngredientJD.setAlwaysOnTop(true);
2708 addItemJD.setVisible(false);
2709 refreshGUITable(ingredientsTable3, "cs_ia.ingredient_bases", ingredientsOrder);
2710 }
2711
2712 private void cancelJB10MouseReleased(java.awt.event.MouseEvent evt) {
2713 recipeTable1.clearSelection();
2714 quantityJS2.setValue(0);
2715 storageCB2.setSelectedIndex(0);
2716 yearJS2.setValue(0);
2717 monthJS2.setValue(0);
2718 dayJS2.setValue(0);
2719 addCookedMealJD.setVisible(false);
2720 }
2721
2722 private void addJB6MouseReleased(java.awt.event.MouseEvent evt) {
2723 if(recipeTable1.getSelectedRowCount() == 1 && (int) quantityJS2.getValue() > 0 && storageCB2.getSelectedIndex() != 0 && (int) yearJS2.getValue() > 0 && (int) monthJS2.getValue() > 0 && (int) dayJS2.getValue() > 0){
2724 try{
2725 myConn = DriverManager.getConnection(dbUrl, user, pass);
2726 myStmt = myConn.createStatement();
2727 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.cooked_meals");
2728
2729 String name = (String) recipeTable1.getValueAt(recipeTable1.getSelectedRow(), 0);
2730
2731 String date = "20";
2732 String temp = yearJS2.getValue() + "";
2733 if(temp.length() == 1){
2734 date = "200";
2735 }
2736 date += yearJS2.getValue() + "";
2737 temp = monthJS2.getValue() + "";
2738 if(temp.length() == 1){
2739 temp = "0" + temp;
2740 }
2741 date += "-" + temp;
2742 temp = dayJS2.getValue() + "";
2743 if(temp.length() == 1){
2744 temp = "0" + temp;
2745 }
2746 date += "-" + temp;
2747
2748 String storage = "";
2749 if(storageCB2.getSelectedIndex() == 1){
2750 storage = "cs_ia.fridge_1";
2751 }else if(storageCB2.getSelectedIndex() == 2){
2752 storage = "cs_ia.fridge_2";
2753 }else if(storageCB2.getSelectedIndex() == 3){
2754 storage = "cs_ia.freezer_1";
2755 }else if(storageCB2.getSelectedIndex() == 4){
2756 storage = "cs_ia.freezer_2";
2757 }
2758
2759 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.recipes WHERE (name = '" + name + "');");
2760 myRs.next();
2761
2762 myStmt.executeUpdate("INSERT INTO cs_ia.cooked_meals (recipe_id, quantity, expiration_date, storage) VALUES ('" + myRs.getString("recipe_id") + "', '" + quantityJS2.getValue() + "', '" + date + "', '" + storage + "');");
2763
2764 refreshSQLTables();
2765 refreshAllGUITables();
2766 }catch(SQLException e){
2767 e.printStackTrace();
2768 }
2769
2770 recipeTable1.clearSelection();
2771 quantityJS2.setValue(0);
2772 storageCB2.setSelectedIndex(0);
2773 yearJS2.setValue(0);
2774 monthJS2.setValue(0);
2775 dayJS2.setValue(0);
2776 addCookedMealJD.setVisible(false);
2777 }else{
2778 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2779 JOptionPane.showMessageDialog(this, "Please input all values and select one row.");
2780 }
2781 }
2782
2783 private void addJB6ActionPerformed(java.awt.event.ActionEvent evt) {
2784
2785 }
2786
2787 private void addCookedMealJBMouseReleased(java.awt.event.MouseEvent evt) {
2788 addCookedMealJD.setVisible(true);
2789 addCookedMealJD.setBounds(500, 250, 640, 385);
2790 addCookedMealJD.setAlwaysOnTop(true);
2791 addItemJD.setVisible(false);
2792 refreshGUITable(recipeTable1, "cs_ia.recipes", recipesOrder);
2793 }
2794
2795 private void editJBMouseReleased(java.awt.event.MouseEvent evt) {
2796 if(fridge1Table.getSelectedRowCount() + fridge2Table.getSelectedRowCount() + freezer1Table.getSelectedRowCount() + freezer2Table.getSelectedRowCount() == 1){
2797 try{
2798 JTable[] GUITable = {fridge1Table, fridge2Table, freezer1Table, freezer2Table};
2799 String[] SQLTables = {"cs_ia.fridge_1", "cs_ia.fridge_2", "cs_ia.freezer_1", "cs_ia.freezer_2"};
2800
2801 for(int i = 0; i < GUITable.length; i++){
2802 if(GUITable[i].getSelectedRowCount() > 0){
2803 myRs = myStmt.executeQuery("SELECT * FROM " + SQLTables[i] + " WHERE (name = '" + GUITable[i].getValueAt(GUITable[i].getSelectedRow(), 0) + "')");
2804 myRs.next();
2805 if(myRs.getString("food_type").equals("1")){
2806 addIngredientJD.setVisible(true);
2807 addIngredientJD.setBounds(500, 250, 640, 385);
2808 addIngredientJD.setAlwaysOnTop(true);
2809 refreshGUITable(ingredientsTable3, "cs_ia.ingredient_bases", ingredientsOrder);
2810 }else if(myRs.getString("food_type").equals("2")){
2811 addCookedMealJD.setVisible(true);
2812 addCookedMealJD.setBounds(500, 250, 640, 385);
2813 addCookedMealJD.setAlwaysOnTop(true);
2814 refreshGUITable(recipeTable1, "cs_ia.recipes", recipesOrder);
2815 }else if(myRs.getString("food_type").equals("3")){
2816 editBoughtFoodJD.setVisible(true);
2817 editBoughtFoodJD.setBounds(500, 250, 363, 424);
2818 editBoughtFoodJD.setAlwaysOnTop(true);
2819 foodNameTF1.setText((String) GUITable[i].getValueAt(GUITable[i].getSelectedRow(), 0));
2820 quantityJS3.setValue(Integer.parseInt((String) GUITable[i].getValueAt(GUITable[i].getSelectedRow(), 1)));
2821 storageCB3.setSelectedIndex(i + 1);
2822 String date = (String) GUITable[i].getValueAt(GUITable[i].getSelectedRow(), 2);
2823 yearJS3.setValue(Integer.parseInt((String) date.substring(2, 4)));
2824 monthJS3.setValue(Integer.parseInt((String) date.substring(5, 7)));
2825 dayJS3.setValue(Integer.parseInt((String) date.substring(8, 10)));
2826 }
2827 }
2828 }
2829 }catch(SQLException e){
2830 e.printStackTrace();
2831 }
2832 }else{
2833 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2834 JOptionPane.showMessageDialog(this, "Please select one row from one table.");
2835 }
2836 }
2837
2838 private void cancelJB11MouseReleased(java.awt.event.MouseEvent evt) {
2839 foodNameTF1.setText("");
2840 quantityJS3.setValue(0);
2841 storageCB3.setSelectedIndex(0);
2842 yearJS3.setValue(0);
2843 monthJS3.setValue(0);
2844 dayJS3.setValue(0);
2845 editBoughtFoodJD.setVisible(false);
2846 }
2847
2848 private void saveJB2MouseReleased(java.awt.event.MouseEvent evt) {
2849 if(!foodNameTF1.getText().equals("") && (int) quantityJS3.getValue() > 0 && storageCB3.getSelectedIndex() != 0 && (int) yearJS3.getValue() > 0 && (int) monthJS3.getValue() > 0 && (int) dayJS3.getValue() > 0){
2850 try{
2851 myConn = DriverManager.getConnection(dbUrl, user, pass);
2852 myStmt = myConn.createStatement();
2853 myRs = myStmt.executeQuery("SELECT * FROM cs_ia.bought_meals");
2854
2855
2856 String date = "20";
2857 String temp = yearJS3.getValue() + "";
2858 if(temp.length() == 1){
2859 date = "200";
2860 }
2861 date += yearJS3.getValue() + "";
2862 temp = monthJS3.getValue() + "";
2863 if(temp.length() == 1){
2864 temp = "0" + temp;
2865 }
2866 date += "-" + temp;
2867 temp = dayJS3.getValue() + "";
2868 if(temp.length() == 1){
2869 temp = "0" + temp;
2870 }
2871 date += "-" + temp;
2872
2873 String storage = "";
2874 if(storageCB3.getSelectedIndex() == 1){
2875 storage = "cs_ia.fridge_1";
2876 }else if(storageCB3.getSelectedIndex() == 2){
2877 storage = "cs_ia.fridge_2";
2878 }else if(storageCB3.getSelectedIndex() == 3){
2879 storage = "cs_ia.freezer_1";
2880 }else if(storageCB3.getSelectedIndex() == 4){
2881 storage = "cs_ia.freezer_2";
2882 }
2883
2884 myStmt.executeUpdate("UPDATE cs_ia.bought_meals SET name = '" + foodNameTF1.getText() + "'" +
2885 ", quantity = '" + quantityJS3.getValue() + "'" +
2886 ", expiration_date = '" + date + "'" +
2887 ", storage = '" + storage + "'" +
2888 " WHERE (name = '" + foodNameTF1.getText() + "');");
2889
2890 refreshSQLTables();
2891 refreshAllGUITables();
2892
2893
2894 }catch(SQLException e){
2895 e.printStackTrace();
2896 }
2897
2898 foodNameTF1.setText("");
2899 quantityJS3.setValue(0);
2900 storageCB3.setSelectedIndex(0);
2901 yearJS3.setValue(0);
2902 monthJS3.setValue(0);
2903 dayJS3.setValue(0);
2904 editBoughtFoodJD.setVisible(false);
2905 }else{
2906 https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
2907 JOptionPane.showMessageDialog(this, "Please input all values.");
2908 }
2909 }
2910
2911 private void saveJB2ActionPerformed(java.awt.event.ActionEvent evt) {
2912
2913 }
2914
2915 private void addItemJB2ActionPerformed(java.awt.event.ActionEvent evt) {
2916
2917 }
2918
2919
2920 @param args
2921
2922 public static void main(String args[]) {
2923
2924
2925
2926 http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
2927
2928 try {
2929 for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
2930 if ("Nimbus".equals(info.getName())) {
2931 javax.swing.UIManager.setLookAndFeel(info.getClassName());
2932 break;
2933 }
2934 }
2935 } catch (ClassNotFoundException ex) {
2936 java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
2937 } catch (InstantiationException ex) {
2938 java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
2939 } catch (IllegalAccessException ex) {
2940 java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
2941 } catch (javax.swing.UnsupportedLookAndFeelException ex) {
2942 java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
2943 }
2944
2945
2946
2947
2948 java.awt.EventQueue.invokeLater(new Runnable() {
2949 public void run() {
2950 try {
2951 new MainGUI().setVisible(true);
2952 } catch (ClassNotFoundException ex) {
2953 Logger.getLogger(MainGUI.class.getName()).log(Level.SEVERE, null, ex);
2954 }
2955
2956 }
2957 });
2958 }
2959
2960 // Variables declaration - do not modify
2961 private javax.swing.JMenuItem aboutMenuItem;
2962 private javax.swing.JButton addBoughtFoodJB;
2963 private javax.swing.JDialog addBoughtFoodJD;
2964 private javax.swing.JButton addCookedMealJB;
2965 private javax.swing.JDialog addCookedMealJD;
2966 private javax.swing.JButton addIngredientJB;
2967 private javax.swing.JDialog addIngredientJD;
2968 private javax.swing.JButton addItemJB2;
2969 private javax.swing.JDialog addItemJD;
2970 private javax.swing.JButton addJB;
2971 private javax.swing.JButton addJB1;
2972 private javax.swing.JButton addJB4;
2973 private javax.swing.JButton addJB5;
2974 private javax.swing.JButton addJB6;
2975 private javax.swing.JButton cancelJB;
2976 private javax.swing.JButton cancelJB1;
2977 private javax.swing.JButton cancelJB10;
2978 private javax.swing.JButton cancelJB11;
2979 private javax.swing.JButton cancelJB4;
2980 private javax.swing.JButton cancelJB6;
2981 private javax.swing.JButton cancelJB7;
2982 private javax.swing.JButton cancelJB8;
2983 private javax.swing.JButton cancelJB9;
2984 private javax.swing.JMenuItem contentsMenuItem;
2985 private javax.swing.JMenuItem copyMenuItem;
2986 private javax.swing.JButton createIngredientJB;
2987 private javax.swing.JDialog createIngredientJD;
2988 private javax.swing.JButton createRecipeJB;
2989 private javax.swing.JDialog createRecipeJD;
2990 private javax.swing.JMenuItem cutMenuItem;
2991 private javax.swing.JSpinner dayJS;
2992 private javax.swing.JSpinner dayJS1;
2993 private javax.swing.JSpinner dayJS2;
2994 private javax.swing.JSpinner dayJS3;
2995 private javax.swing.JButton deleteJB;
2996 private javax.swing.JButton deleteJB2;
2997 private javax.swing.JMenuItem deleteMenuItem;
2998 private javax.swing.JDialog editBoughtFoodJD;
2999 private javax.swing.JDialog editIngredientJD;
3000 private javax.swing.JButton editJB;
3001 private javax.swing.JButton editJB1;
3002 private javax.swing.JMenu editMenu;
3003 private javax.swing.JDialog editRecipeJD;
3004 private javax.swing.JMenuItem exitMenuItem;
3005 private javax.swing.JTable expiredTable;
3006 private javax.swing.JTable expiringTable;
3007 private javax.swing.JMenu fileMenu;
3008 private javax.swing.JComboBox<String> filterCB;
3009 private javax.swing.JTextField foodNameTF;
3010 private javax.swing.JTextField foodNameTF1;
3011 private javax.swing.JTable freezer1Table;
3012 private javax.swing.JTable freezer2Table;
3013 private javax.swing.JTable fridge1Table;
3014 private javax.swing.JTable fridge2Table;
3015 private javax.swing.JMenu helpMenu;
3016 private javax.swing.JTextField ingredientTF;
3017 private javax.swing.JTextField ingredientTF1;
3018 private javax.swing.JTable ingredientsTable;
3019 private javax.swing.JTable ingredientsTable1;
3020 private javax.swing.JTable ingredientsTable2;
3021 private javax.swing.JTable ingredientsTable3;
3022 private javax.swing.JLabel jLabel;
3023 private javax.swing.JLabel jLabel1;
3024 private javax.swing.JLabel jLabel10;
3025 private javax.swing.JLabel jLabel11;
3026 private javax.swing.JLabel jLabel12;
3027 private javax.swing.JLabel jLabel13;
3028 private javax.swing.JLabel jLabel14;
3029 private javax.swing.JLabel jLabel15;
3030 private javax.swing.JLabel jLabel16;
3031 private javax.swing.JLabel jLabel17;
3032 private javax.swing.JLabel jLabel18;
3033 private javax.swing.JLabel jLabel19;
3034 private javax.swing.JLabel jLabel2;
3035 private javax.swing.JLabel jLabel20;
3036 private javax.swing.JLabel jLabel21;
3037 private javax.swing.JLabel jLabel22;
3038 private javax.swing.JLabel jLabel23;
3039 private javax.swing.JLabel jLabel24;
3040 private javax.swing.JLabel jLabel25;
3041 private javax.swing.JLabel jLabel26;
3042 private javax.swing.JLabel jLabel27;
3043 private javax.swing.JLabel jLabel28;
3044 private javax.swing.JLabel jLabel29;
3045 private javax.swing.JLabel jLabel3;
3046 private javax.swing.JLabel jLabel30;
3047 private javax.swing.JLabel jLabel31;
3048 private javax.swing.JLabel jLabel32;
3049 private javax.swing.JLabel jLabel33;
3050 private javax.swing.JLabel jLabel34;
3051 private javax.swing.JLabel jLabel35;
3052 private javax.swing.JLabel jLabel36;
3053 private javax.swing.JLabel jLabel37;
3054 private javax.swing.JLabel jLabel38;
3055 private javax.swing.JLabel jLabel39;
3056 private javax.swing.JLabel jLabel4;
3057 private javax.swing.JLabel jLabel40;
3058 private javax.swing.JLabel jLabel41;
3059 private javax.swing.JLabel jLabel42;
3060 private javax.swing.JLabel jLabel43;
3061 private javax.swing.JLabel jLabel44;
3062 private javax.swing.JLabel jLabel45;
3063 private javax.swing.JLabel jLabel46;
3064 private javax.swing.JLabel jLabel47;
3065 private javax.swing.JLabel jLabel5;
3066 private javax.swing.JLabel jLabel6;
3067 private javax.swing.JLabel jLabel7;
3068 private javax.swing.JLabel jLabel8;
3069 private javax.swing.JPanel jPanel1;
3070 private javax.swing.JPanel jPanel2;
3071 private javax.swing.JPanel jPanel3;
3072 private javax.swing.JScrollPane jScrollPane1;
3073 private javax.swing.JScrollPane jScrollPane12;
3074 private javax.swing.JScrollPane jScrollPane13;
3075 private javax.swing.JScrollPane jScrollPane14;
3076 private javax.swing.JScrollPane jScrollPane15;
3077 private javax.swing.JScrollPane jScrollPane2;
3078 private javax.swing.JScrollPane jScrollPane3;
3079 private javax.swing.JScrollPane jScrollPane4;
3080 private javax.swing.JScrollPane jScrollPane5;
3081 private javax.swing.JScrollPane jScrollPane6;
3082 private javax.swing.JScrollPane jScrollPane7;
3083 private javax.swing.JScrollPane jScrollPane8;
3084 private javax.swing.JScrollPane jScrollPane9;
3085 private javax.swing.JTabbedPane jTabbedPane1;
3086 private javax.swing.JMenuBar menuBar;
3087 private javax.swing.JButton minusJB;
3088 private javax.swing.JSpinner monthJS;
3089 private javax.swing.JSpinner monthJS1;
3090 private javax.swing.JSpinner monthJS2;
3091 private javax.swing.JSpinner monthJS3;
3092 private javax.swing.JMenuItem openMenuItem;
3093 private javax.swing.JMenuItem pasteMenuItem;
3094 private javax.swing.JButton plusJB;
3095 private javax.swing.JSpinner quantityJS;
3096 private javax.swing.JSpinner quantityJS1;
3097 private javax.swing.JSpinner quantityJS2;
3098 private javax.swing.JSpinner quantityJS3;
3099 private javax.swing.JTextField recipeNameTF;
3100 private javax.swing.JTextField recipeNameTF1;
3101 private javax.swing.JTable recipeTable1;
3102 private javax.swing.JTable recipesTable;
3103 private javax.swing.JMenuItem saveAsMenuItem;
3104 private javax.swing.JButton saveJB;
3105 private javax.swing.JButton saveJB1;
3106 private javax.swing.JButton saveJB2;
3107 private javax.swing.JMenuItem saveMenuItem;
3108 private javax.swing.JComboBox<String> storageCB;
3109 private javax.swing.JComboBox<String> storageCB1;
3110 private javax.swing.JComboBox<String> storageCB2;
3111 private javax.swing.JComboBox<String> storageCB3;
3112 private javax.swing.JTable suggestionsTable;
3113 private javax.swing.JComboBox<String> typeCB;
3114 private javax.swing.JComboBox<String> typeCB1;
3115 private javax.swing.JSpinner yearJS;
3116 private javax.swing.JSpinner yearJS1;
3117 private javax.swing.JSpinner yearJS2;
3118 private javax.swing.JSpinner yearJS3;
3119 // End of variables declaration
3120
3121 }
3122