/Users/johnr/Desktop/IA_14_-_Stage_P_Upload_all_2021-04-08/GUI - Alan/src/main/java/MainGUI.java |
1
2 import java.util.ArrayList;
3 import java.util.Enumeration;
4 import javax.swing.AbstractButton;
5 import javax.swing.ButtonGroup;
6
7
8
9
10
11
12
13
14
15 @author
16
17 public class MainGUI extends javax.swing.JFrame {
18
19 private ArrayList<Trip> tripsQueue = new ArrayList<Trip>();
20 private ArrayList<Expense> expenses = new ArrayList<Expense>();
21
22 public MainGUI() {
23 initComponents();
24 }
25
26
27 This method is called from within the constructor to initialize the form.
28
29
30
Netbeans auto-generated GUI code pasted at end of this document.
476
477 private void addTripButtonMouseReleased(java.awt.event.MouseEvent evt) {
478
479
480 if(nameOfTripTF.equals("")){
481 errorTF.setText("Please enter a Trip Name");
482 } else if(numberOfPeopleTF.equals("")) {
483 errorTF.setText("Please enter the Number of People");
484 } else if(numberOfPeopleTF.equals("^\\d+(\\.\\d+)?")){
485 errorTF.setText("Please enter the Number of People");
486 } else if (budgetTF.equals("")) {
487 errorTF.setText("Please enter a Budget");
488 } else if(budgetTF.equals("^\\d+(\\.\\d+)?")) {
489 errorTF.setText("Please enter a Budget");
490 } else {
491 tripsQueue.add(new Trip(nameOfTripTF.getText(), Integer.parseInt(numberOfPeopleTF.getText()),
492 Double.parseDouble(budgetTF.getText())));
493 tripNameTF.setText(nameOfTripTF.getText());
494 nameOfTripTF.setText("");
495 numberOfPeopleTF.setText("");
496 budgetTF.setText("");
497 }
498
499 }
500
501 private void sortComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519 }
520
521 private void otherButtonActionPerformed(java.awt.event.ActionEvent evt) {
522
523 }
524
525 private void addExpenseButtonActionPerformed(java.awt.event.ActionEvent evt) {
526
527 }
528
529 private void addExpenseButtonMouseReleased(java.awt.event.MouseEvent evt) {
530
531 String getSelectedButtonText = " ";
532
533 if (travelButton.isSelected()) {
534 getSelectedButtonText = "Travel";
535 } else if (foodButton.isSelected()) {
536 getSelectedButtonText = "Food";
537 } else if (accommodationButton.isSelected()) {
538 getSelectedButtonText = "Accomodation";
539 } else if (activityButton.isSelected()) {
540 getSelectedButtonText = "Activity";
541 } else if (otherButton.isSelected()) {
542 getSelectedButtonText = otherTF.getText();
543 } else {
544 errorTF2.setText("Please select an expense type");
545 }
546
547
548
549
550
551
552
553
554
555 expenses.add(new Expense( tripNameTF.getText(), nameOfExpenseTF.getText(), getSelectedButtonText, Double.parseDouble(costOfExpenseTF.getText() )));
556
557 nameOfExpenseTF.setText("");
558 costOfExpenseTF.setText("");
559
560 }
561
562 private void refreshButtonMouseReleased(java.awt.event.MouseEvent evt) {
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580 String selectedItemStr = " ";
581 Object selectedItem = sortComboBox.getSelectedItem();
582
583 if (selectedItem.equals("Sort By Trip")) {
584
585 SortAndSearchExpense s = new SortAndSearchExpense();
586 s.selectionSortOfExpensesByTrip(expenses);
587
588 if (expenses.size() <= expenseTable.getRowCount()) {
589
590 for (int x = 0; x < expenses.size(); x++) {
591
592 expenseTable.setValueAt(expenses.get(x).getTripName(), x, 0);
593 expenseTable.setValueAt(expenses.get(x).getNameOfExpense(), x, 1);
594 expenseTable.setValueAt(expenses.get(x).getTypeOfExpense(), x, 2);
595 expenseTable.setValueAt(expenses.get(x).getCostOfExpense(), x, 3);
596
597 }
598
599 }
600
601 } else if (selectedItem.equals("Sort By Name")) {
602
603 SortAndSearchExpense s = new SortAndSearchExpense();
604 s.selectionSortOfExpensesByName(expenses);
605
606 if (expenses.size() <= expenseTable.getRowCount()) {
607
608 for (int x = 0; x < expenses.size(); x++) {
609
610 expenseTable.setValueAt(expenses.get(x).getTripName(), x, 0);
611 expenseTable.setValueAt(expenses.get(x).getNameOfExpense(), x, 1);
612 expenseTable.setValueAt(expenses.get(x).getTypeOfExpense(), x, 2);
613 expenseTable.setValueAt(expenses.get(x).getCostOfExpense(), x, 3);
614
615 }
616
617 }
618
619 } else if (selectedItem.equals("Sort By Type")) {
620
621 SortAndSearchExpense s = new SortAndSearchExpense();
622 s.selectionSortOfExpensesByType(expenses);
623
624 if (expenses.size() <= expenseTable.getRowCount()) {
625
626 for (int x = 0; x < expenses.size(); x++) {
627
628 expenseTable.setValueAt(expenses.get(x).getTripName(), x, 0);
629 expenseTable.setValueAt(expenses.get(x).getNameOfExpense(), x, 1);
630 expenseTable.setValueAt(expenses.get(x).getTypeOfExpense(), x, 2);
631 expenseTable.setValueAt(expenses.get(x).getCostOfExpense(), x, 3);
632
633 }
634
635 }
636
637 } else if (selectedItem.equals("Sort By Cost")) {
638
639 SortAndSearchExpense s = new SortAndSearchExpense();
640 s.selectionSortOfExpensesByCost(expenses);
641
642 if (expenses.size() <= expenseTable.getRowCount()) {
643
644 for (int x = 0; x < expenses.size(); x++) {
645
646 expenseTable.setValueAt(expenses.get(x).getTripName(), x, 0);
647 expenseTable.setValueAt(expenses.get(x).getNameOfExpense(), x, 1);
648 expenseTable.setValueAt(expenses.get(x).getTypeOfExpense(), x, 2);
649 expenseTable.setValueAt(expenses.get(x).getCostOfExpense(), x, 3);
650
651 }
652
653 }
654
655 }
656
657
658 }
659
660 private void tripNameTFActionPerformed(java.awt.event.ActionEvent evt) {
661
662 }
663
664 private void budgetTFActionPerformed(java.awt.event.ActionEvent evt) {
665
666 }
667
668 private void errorTFActionPerformed(java.awt.event.ActionEvent evt) {
669
670 }
671
672 private void errorTF2ActionPerformed(java.awt.event.ActionEvent evt) {
673
674 }
675
676
677 @param args
678
679 public static void main(String args[]) {
680
681
682
683
684
685 try {
686 for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
687 if ("Nimbus".equals(info.getName())) {
688 javax.swing.UIManager.setLookAndFeel(info.getClassName());
689 break;
690 }
691 }
692 } catch (ClassNotFoundException ex) {
693 java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
694 } catch (InstantiationException ex) {
695 java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
696 } catch (IllegalAccessException ex) {
697 java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
698 } catch (javax.swing.UnsupportedLookAndFeelException ex) {
699 java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
700 }
701
702
703
704 java.awt.EventQueue.invokeLater(new Runnable() {
705 public void run() {
706 new MainGUI().setVisible(true);
707 }
708 });
709 }
Autogenerated Netbeans GUI Code Below:
31 @SuppressWarnings("unchecked")
32 // <editor-fold defaultstate="collapsed" desc="Generated Code">
33 private void initComponents() {
34
35 jPasswordField1 = new javax.swing.JPasswordField();
36 typeOfExpenseButtonGroup = new javax.swing.ButtonGroup();
37 jSplitPane1 = new javax.swing.JSplitPane();
38 jTabbedPane1 = new javax.swing.JTabbedPane();
39 jPanel1 = new javax.swing.JPanel();
40 numberOfPeopleLabel = new javax.swing.JLabel();
41 numberOfPeopleTF = new javax.swing.JTextField();
42 nameOfTripLabel = new javax.swing.JLabel();
43 nameOfTripTF = new javax.swing.JTextField();
44 budgetTF = new javax.swing.JTextField();
45 budgetLabel = new javax.swing.JLabel();
46 addTripButton = new javax.swing.JButton();
47 newTripLabel = new javax.swing.JLabel();
48 expensesLabel = new javax.swing.JLabel();
49 costOfExpenseLabel = new javax.swing.JLabel();
50 travelButton = new javax.swing.JRadioButton();
51 foodButton = new javax.swing.JRadioButton();
52 accommodationButton = new javax.swing.JRadioButton();
53 costOfExpenseTF = new javax.swing.JTextField();
54 typeOfExpenseLabel = new javax.swing.JLabel();
55 activityButton = new javax.swing.JRadioButton();
56 addExpenseButton = new javax.swing.JButton();
57 nameOfExpenseLabel = new javax.swing.JLabel();
58 nameOfExpenseTF = new javax.swing.JTextField();
59 tripNameLabel = new javax.swing.JLabel();
60 otherButton = new javax.swing.JRadioButton();
61 otherTF = new javax.swing.JTextField();
62 errorTB = new javax.swing.JLabel();
63 tripNameTF = new javax.swing.JTextField();
64 errorTF = new javax.swing.JTextField();
65 errorTF2 = new javax.swing.JTextField();
66 jPanel3 = new javax.swing.JPanel();
67 jScrollPane1 = new javax.swing.JScrollPane();
68 expenseTable = new javax.swing.JTable();
69 sortComboBox = new javax.swing.JComboBox<>();
70 refreshButton = new javax.swing.JButton();
71 jMenuBar1 = new javax.swing.JMenuBar();
72 jMenu1 = new javax.swing.JMenu();
73 jMenu2 = new javax.swing.JMenu();
74 jMenu3 = new javax.swing.JMenu();
75
76 jPasswordField1.setText("jPasswordField1");
77
78 setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
79
80 numberOfPeopleLabel.setText("Number of People");
81
82 nameOfTripLabel.setText("Name of Trip");
83
84 budgetTF.addActionListener(new java.awt.event.ActionListener() {
85 public void actionPerformed(java.awt.event.ActionEvent evt) {
86 budgetTFActionPerformed(evt);
87 }
88 });
89
90 budgetLabel.setText("Budget");
91
92 addTripButton.setText("Enter");
93 addTripButton.addMouseListener(new java.awt.event.MouseAdapter() {
94 public void mouseReleased(java.awt.event.MouseEvent evt) {
95 addTripButtonMouseReleased(evt);
96 }
97 });
98
99 newTripLabel.setText("New Trip");
100
101 expensesLabel.setText("Expenses");
102
103 costOfExpenseLabel.setText("Cost of Expense");
104
105 typeOfExpenseButtonGroup.add(travelButton);
106 travelButton.setText("Travel");
107
108 typeOfExpenseButtonGroup.add(foodButton);
109 foodButton.setText("Food");
110
111 typeOfExpenseButtonGroup.add(accommodationButton);
112 accommodationButton.setText("Accommodation");
113
114 typeOfExpenseLabel.setText("Type of Expense");
115
116 typeOfExpenseButtonGroup.add(activityButton);
117 activityButton.setText("Activity");
118
119 addExpenseButton.setText("Enter");
120 addExpenseButton.addMouseListener(new java.awt.event.MouseAdapter() {
121 public void mouseReleased(java.awt.event.MouseEvent evt) {
122 addExpenseButtonMouseReleased(evt);
123 }
124 });
125 addExpenseButton.addActionListener(new java.awt.event.ActionListener() {
126 public void actionPerformed(java.awt.event.ActionEvent evt) {
127 addExpenseButtonActionPerformed(evt);
128 }
129 });
130
131 nameOfExpenseLabel.setText("Name of Expense");
132
133 tripNameLabel.setText("Trip");
134
135 typeOfExpenseButtonGroup.add(otherButton);
136 otherButton.setText("Other");
137 otherButton.addActionListener(new java.awt.event.ActionListener() {
138 public void actionPerformed(java.awt.event.ActionEvent evt) {
139 otherButtonActionPerformed(evt);
140 }
141 });
142
143 tripNameTF.addActionListener(new java.awt.event.ActionListener() {
144 public void actionPerformed(java.awt.event.ActionEvent evt) {
145 tripNameTFActionPerformed(evt);
146 }
147 });
148
149 errorTF.setBackground(javax.swing.UIManager.getDefaults().getColor("Button.background"));
150 errorTF.setBorder(null);
151 errorTF.addActionListener(new java.awt.event.ActionListener() {
152 public void actionPerformed(java.awt.event.ActionEvent evt) {
153 errorTFActionPerformed(evt);
154 }
155 });
156
157 errorTF2.setBackground(javax.swing.UIManager.getDefaults().getColor("Button.background"));
158 errorTF2.setBorder(null);
159 errorTF2.addActionListener(new java.awt.event.ActionListener() {
160 public void actionPerformed(java.awt.event.ActionEvent evt) {
161 errorTF2ActionPerformed(evt);
162 }
163 });
164
165 javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
166 jPanel1.setLayout(jPanel1Layout);
167 jPanel1Layout.setHorizontalGroup(
168 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
169 .addGroup(jPanel1Layout.createSequentialGroup()
170 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
171 .addGroup(jPanel1Layout.createSequentialGroup()
172 .addGap(42, 42, 42)
173 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
174 .addComponent(numberOfPeopleLabel)
175 .addComponent(budgetLabel)
176 .addComponent(nameOfTripLabel))
177 .addGap(47, 47, 47)
178 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
179 .addComponent(nameOfTripTF, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
180 .addComponent(numberOfPeopleTF, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
181 .addComponent(budgetTF, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)))
182 .addGroup(jPanel1Layout.createSequentialGroup()
183 .addGap(120, 120, 120)
184 .addComponent(newTripLabel))
185 .addGroup(jPanel1Layout.createSequentialGroup()
186 .addContainerGap()
187 .addComponent(errorTF, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
188 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
189 .addComponent(addTripButton)))
190 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
191 .addGroup(jPanel1Layout.createSequentialGroup()
192 .addGap(121, 121, 121)
193 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
194 .addGroup(jPanel1Layout.createSequentialGroup()
195 .addGap(231, 231, 231)
196 .addComponent(expensesLabel))
197 .addGroup(jPanel1Layout.createSequentialGroup()
198 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
199 .addComponent(nameOfExpenseLabel)
200 .addComponent(tripNameLabel)
201 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
202 .addComponent(costOfExpenseLabel)
203 .addComponent(typeOfExpenseLabel)))
204 .addGap(98, 98, 98)
205 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
206 .addGroup(jPanel1Layout.createSequentialGroup()
207 .addComponent(otherButton)
208 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
209 .addComponent(otherTF, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
210 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
211 .addComponent(foodButton, javax.swing.GroupLayout.Alignment.LEADING)
212 .addComponent(travelButton, javax.swing.GroupLayout.Alignment.LEADING)
213 .addComponent(accommodationButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
214 .addComponent(activityButton, javax.swing.GroupLayout.Alignment.LEADING)
215 .addComponent(nameOfExpenseTF, javax.swing.GroupLayout.Alignment.LEADING)
216 .addComponent(costOfExpenseTF, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
217 .addComponent(tripNameTF, javax.swing.GroupLayout.Alignment.LEADING)))))
218 .addGap(176, 176, 176))
219 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
220 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
221 .addComponent(errorTF2, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
222 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
223 .addComponent(addExpenseButton)
224 .addGap(265, 265, 265))))
225 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
226 .addContainerGap()
227 .addComponent(errorTB, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
228 .addGap(273, 273, 273))
229 );
230 jPanel1Layout.setVerticalGroup(
231 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
232 .addGroup(jPanel1Layout.createSequentialGroup()
233 .addGap(44, 44, 44)
234 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
235 .addComponent(expensesLabel)
236 .addComponent(newTripLabel))
237 .addGap(50, 50, 50)
238 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
239 .addComponent(tripNameLabel)
240 .addComponent(tripNameTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
241 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
242 .addGroup(jPanel1Layout.createSequentialGroup()
243 .addGap(38, 38, 38)
244 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
245 .addComponent(nameOfExpenseLabel)
246 .addComponent(nameOfTripLabel)
247 .addComponent(nameOfTripTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
248 .addGap(131, 131, 131)
249 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
250 .addComponent(budgetLabel)
251 .addComponent(budgetTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
252 .addGroup(jPanel1Layout.createSequentialGroup()
253 .addGap(37, 37, 37)
254 .addComponent(nameOfExpenseTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
255 .addGap(20, 20, 20)
256 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
257 .addComponent(travelButton)
258 .addComponent(typeOfExpenseLabel))
259 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
260 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
261 .addComponent(foodButton)
262 .addComponent(numberOfPeopleTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
263 .addComponent(numberOfPeopleLabel))
264 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
265 .addComponent(accommodationButton)
266 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
267 .addComponent(activityButton)
268 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
269 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
270 .addComponent(otherButton)
271 .addComponent(otherTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
272 .addGap(30, 30, 30)
273 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
274 .addComponent(costOfExpenseTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
275 .addComponent(costOfExpenseLabel))
276 .addGap(18, 18, 18)
277 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
278 .addComponent(addExpenseButton)
279 .addComponent(addTripButton)
280 .addComponent(errorTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
281 .addComponent(errorTF2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
282 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
283 .addComponent(errorTB, javax.swing.GroupLayout.DEFAULT_SIZE, 9, Short.MAX_VALUE)
284 .addContainerGap())
285 );
286
287 jTabbedPane1.addTab("Input", jPanel1);
288
289 expenseTable.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
290 expenseTable.setModel(new javax.swing.table.DefaultTableModel(
291 new Object [][] {
292 {null, null, null, null},
293 {null, null, null, null},
294 {null, null, null, null},
295 {null, null, null, null},
296 {null, null, null, null},
297 {null, null, null, null},
298 {null, null, null, null},
299 {null, null, null, null},
300 {null, null, null, null},
301 {null, null, null, null},
302 {null, null, null, null},
303 {null, null, null, null},
304 {null, null, null, null},
305 {null, null, null, null},
306 {null, null, null, null},
307 {null, null, null, null},
308 {null, null, null, null},
309 {null, null, null, null},
310 {null, null, null, null},
311 {null, null, null, null},
312 {null, null, null, null},
313 {null, null, null, null},
314 {null, null, null, null},
315 {null, null, null, null},
316 {null, null, null, null},
317 {null, null, null, null},
318 {null, null, null, null},
319 {null, null, null, null},
320 {null, null, null, null},
321 {null, null, null, null},
322 {null, null, null, null},
323 {null, null, null, null},
324 {null, null, null, null},
325 {null, null, null, null},
326 {null, null, null, null},
327 {null, null, null, null},
328 {null, null, null, null},
329 {null, null, null, null},
330 {null, null, null, null},
331 {null, null, null, null},
332 {null, null, null, null},
333 {null, null, null, null},
334 {null, null, null, null},
335 {null, null, null, null},
336 {null, null, null, null},
337 {null, null, null, null},
338 {null, null, null, null},
339 {null, null, null, null},
340 {null, null, null, null},
341 {null, null, null, null},
342 {null, null, null, null},
343 {null, null, null, null},
344 {null, null, null, null},
345 {null, null, null, null},
346 {null, null, null, null},
347 {null, null, null, null},
348 {null, null, null, null},
349 {null, null, null, null},
350 {null, null, null, null},
351 {null, null, null, null},
352 {null, null, null, null},
353 {null, null, null, null},
354 {null, null, null, null},
355 {null, null, null, null},
356 {null, null, null, null},
357 {null, null, null, null},
358 {null, null, null, null},
359 {null, null, null, null},
360 {null, null, null, null},
361 {null, null, null, null},
362 {null, null, null, null},
363 {null, null, null, null},
364 {null, null, null, null},
365 {null, null, null, null},
366 {null, null, null, null},
367 {null, null, null, null},
368 {null, null, null, null},
369 {null, null, null, null},
370 {null, null, null, null},
371 {null, null, null, null},
372 {null, null, null, null},
373 {null, null, null, null},
374 {null, null, null, null},
375 {null, null, null, null},
376 {null, null, null, null},
377 {null, null, null, null},
378 {null, null, null, null},
379 {null, null, null, null},
380 {null, null, null, null},
381 {null, null, null, null},
382 {null, null, null, null},
383 {null, null, null, null},
384 {null, null, null, null},
385 {null, null, null, null},
386 {null, null, null, null},
387 {null, null, null, null},
388 {null, null, null, null},
389 {null, null, null, null},
390 {null, null, null, null},
391 {null, null, null, null}
392 },
393 new String [] {
394 "Trip", "Name", "Type", "Cost"
395 }
396 ));
397 expenseTable.setGridColor(new java.awt.Color(0, 0, 0));
398 expenseTable.setShowGrid(true);
399 jScrollPane1.setViewportView(expenseTable);
400
401 sortComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Sort By Trip", "Sort By Name", "Sort By Cost", "Sort By Type" }));
402 sortComboBox.addActionListener(new java.awt.event.ActionListener() {
403 public void actionPerformed(java.awt.event.ActionEvent evt) {
404 sortComboBoxActionPerformed(evt);
405 }
406 });
407
408 refreshButton.setText("Refresh");
409 refreshButton.addMouseListener(new java.awt.event.MouseAdapter() {
410 public void mouseReleased(java.awt.event.MouseEvent evt) {
411 refreshButtonMouseReleased(evt);
412 }
413 });
414
415 javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
416 jPanel3.setLayout(jPanel3Layout);
417 jPanel3Layout.setHorizontalGroup(
418 jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
419 .addGroup(jPanel3Layout.createSequentialGroup()
420 .addContainerGap()
421 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 598, Short.MAX_VALUE)
422 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
423 .addGroup(jPanel3Layout.createSequentialGroup()
424 .addGap(40, 40, 40)
425 .addComponent(sortComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
426 .addGap(25, 25, 25))
427 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
428 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
429 .addComponent(refreshButton)
430 .addGap(72, 72, 72))))
431 );
432 jPanel3Layout.setVerticalGroup(
433 jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
434 .addGroup(jPanel3Layout.createSequentialGroup()
435 .addContainerGap()
436 .addComponent(sortComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
437 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
438 .addComponent(refreshButton)
439 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
440 .addGroup(jPanel3Layout.createSequentialGroup()
441 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 482, Short.MAX_VALUE)
442 .addContainerGap())
443 );
444
445 jTabbedPane1.addTab("Display", jPanel3);
446
447 jMenu1.setText("File");
448 jMenuBar1.add(jMenu1);
449
450 jMenu2.setText("Edit");
451 jMenuBar1.add(jMenu2);
452
453 jMenu3.setText("Help");
454 jMenuBar1.add(jMenu3);
455
456 setJMenuBar(jMenuBar1);
457
458 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
459 getContentPane().setLayout(layout);
460 layout.setHorizontalGroup(
461 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
462 .addGroup(layout.createSequentialGroup()
463 .addContainerGap()
464 .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 875, javax.swing.GroupLayout.PREFERRED_SIZE)
465 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
466 );
467 layout.setVerticalGroup(
468 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
469 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
470 .addGap(0, 12, Short.MAX_VALUE)
471 .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 534, javax.swing.GroupLayout.PREFERRED_SIZE))
472 );
473
474 pack();
475 }// </editor-fold>
710
711 // Variables declaration - do not modify
712 private javax.swing.JRadioButton accommodationButton;
713 private javax.swing.JRadioButton activityButton;
714 private javax.swing.JButton addExpenseButton;
715 private javax.swing.JButton addTripButton;
716 private javax.swing.JLabel budgetLabel;
717 private javax.swing.JTextField budgetTF;
718 private javax.swing.JLabel costOfExpenseLabel;
719 private javax.swing.JTextField costOfExpenseTF;
720 private javax.swing.JLabel errorTB;
721 private javax.swing.JTextField errorTF;
722 private javax.swing.JTextField errorTF2;
723 private javax.swing.JTable expenseTable;
724 private javax.swing.JLabel expensesLabel;
725 private javax.swing.JRadioButton foodButton;
726 private javax.swing.JMenu jMenu1;
727 private javax.swing.JMenu jMenu2;
728 private javax.swing.JMenu jMenu3;
729 private javax.swing.JMenuBar jMenuBar1;
730 private javax.swing.JPanel jPanel1;
731 private javax.swing.JPanel jPanel3;
732 private javax.swing.JPasswordField jPasswordField1;
733 private javax.swing.JScrollPane jScrollPane1;
734 private javax.swing.JSplitPane jSplitPane1;
735 private javax.swing.JTabbedPane jTabbedPane1;
736 private javax.swing.JLabel nameOfExpenseLabel;
737 private javax.swing.JTextField nameOfExpenseTF;
738 private javax.swing.JLabel nameOfTripLabel;
739 private javax.swing.JTextField nameOfTripTF;
740 private javax.swing.JLabel newTripLabel;
741 private javax.swing.JLabel numberOfPeopleLabel;
742 private javax.swing.JTextField numberOfPeopleTF;
743 private javax.swing.JRadioButton otherButton;
744 private javax.swing.JTextField otherTF;
745 private javax.swing.JButton refreshButton;
746 private javax.swing.JComboBox<String> sortComboBox;
747 private javax.swing.JRadioButton travelButton;
748 private javax.swing.JLabel tripNameLabel;
749 private javax.swing.JTextField tripNameTF;
750 private javax.swing.ButtonGroup typeOfExpenseButtonGroup;
751 private javax.swing.JLabel typeOfExpenseLabel;
752 // End of variables declaration
753 }
754