/Users/johnr/Dropbox/johnrayworth.info/largeFilesOutsideJSR/__IB-Other/Other/IA-Solutions-2019/TigerBee/Product/Computer Science Ia/src/computer/science/ia/PrototypeIA.java
  1 package computer.science.ia;
  2 
  3 import java.util.ArrayList;
  4 
  5 /*
  6  * To change this license header, choose License Headers in Project Properties.
  7  * To change this template file, choose Tools | Templates
  8  * and open the template in the editor.
  9  */
 10 
 11 /**
 12  *
 13  * @author 19515
 14  */
 15 // To Do List
 16 
 17 
 18 public class PrototypeIA extends javax.swing.JFrame {
 19     
 20     private ArrayList<Flight> flights = new ArrayList<Flight>();
 21     
 22 
 23     /**
 24      * Creates new form PrototypeIA
 25      */
 26     public PrototypeIA() {
 27         initComponents();
 28         myInit();
 29     }
 30     
 31     public void myInit(){
 32         rawTable.setModel(new javax.swing.table.DefaultTableModel(
 33     new Object [][] {
 34         {null, null, null, null, null, null, null},
 35         {null, null, null, null, null, null, null},
 36         {null, null, null, null, null, null, null},
 37         {null, null, null, null, null, null, null},
 38         {null, null, null, null, null, null, null},
 39         {null, null, null, null, null, null, null},
 40         {null, null, null, null, null, null, null},
 41         {null, null, null, null, null, null, null},
 42         {null, null, null, null, null, null, null},
 43         {null, null, null, null, null, null, null},
 44         {null, null, null, null, null, null, null},
 45     },
 46     new String [] {
 47         "Flight", "Destination", "Distance", "No. of Flt", "Total pas.", "Total Revenue", "Visa required"
 48     }
 49 ));
 50     }
 51 



                                   
589 
590     private void addButtonMouseReleased(java.awt.event.MouseEvent evt) {                                        
591         // TODO add your handling code here:
592         flights.add(new Flight(cityCodeTF.getText(), cityDestinationTF.getText(), Integer.parseInt(numberFlightsTF.getText()),
593                 Integer.parseInt(totalPassengersTF.getText()), Long.parseLong(totalRevenueTF.getText()), 
594                 Integer.parseInt(distanceTF.getText())));
595         cityCodeTF.setText("");
596         cityDestinationTF.setText("");
597         numberFlightsTF.setText("");
598         totalPassengersTF.setText("");
599         totalRevenueTF.setText("");
600         distanceTF.setText("");
601     }                                       
602 
603     private void submitButtonMouseReleased(java.awt.event.MouseEvent evt) {                                           
604         // TODO add your handling code here:
605         SortAndSearchFlight f = new SortAndSearchFlight();
606         f.selectionSortOfFlightCodes(flights);
607         
608         if(flights.size() <= rawTable.getRowCount()){
609             for(int row = 0; row < flights.size(); row++){
610                 rawTable.setValueAt(flights.get(row).getCityCode(), row, 0);
611                 rawTable.setValueAt(flights.get(row).getCityDestination(), row, 1);
612                 rawTable.setValueAt(flights.get(row).getTotalDistance(), row, 2);
613                 rawTable.setValueAt(flights.get(row).getNumberOfFlights(), row, 3);
614                 rawTable.setValueAt(flights.get(row).getTotalPassengers(), row, 4);
615                 rawTable.setValueAt(flights.get(row).getTotalRevenue(), row, 5);
616             } 
617         }
618     }                                          
619 
620     /**
621      * @param args the command line arguments
622      */
623     public static void main(String args[]) {
624         /* Set the Nimbus look and feel */
625         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
626         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
627          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
628          */
629         try {
630             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
631                 if ("Nimbus".equals(info.getName())) {
632                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
633                     break;
634                 }
635             }
636         } catch (ClassNotFoundException ex) {
637             java.util.logging.Logger.getLogger(PrototypeIA.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
638         } catch (InstantiationException ex) {
639             java.util.logging.Logger.getLogger(PrototypeIA.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
640         } catch (IllegalAccessException ex) {
641             java.util.logging.Logger.getLogger(PrototypeIA.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
642         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
643             java.util.logging.Logger.getLogger(PrototypeIA.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
644         }
645         //</editor-fold>
646 
647         /* Create and display the form */
648         java.awt.EventQueue.invokeLater(new Runnable() {
649             public void run() {
650                 new PrototypeIA().setVisible(true);
651             }
652         });
653     }







/*
  39 ####################################################################
  40 ####################################################################
  41 ####################################################################
  42 ####################################################################
  43 ####################################################################
  44 
  45 *************** NOTE THAT ALL THE CODE WHICH IS ********************
  46 *************** HIGHLIGHTED GREY BLOCK IS AUTO- ********************
  47 *************** GENERATED FROM NETBEANS, NOT BY ********************
  48 *************** ME. (It's mainly the GUI stuff.)********************
  49 
  50 ####################################################################
  51 ####################################################################
  52 ####################################################################
  53 ####################################################################
  54 ####################################################################
  55 */
 52     /**
 53      * This method is called from within the constructor to initialize the form.
 54      * WARNING: Do NOT modify this code. The content of this method is always
 55      * regenerated by the Form Editor.
 56      */
 57     @SuppressWarnings("unchecked")
 58     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
 59     private void initComponents() {
 60 
 61         buttonGroup1 = new javax.swing.ButtonGroup();
 62         jTabbedPane1 = new javax.swing.JTabbedPane();
 63         jPanel1 = new javax.swing.JPanel();
 64         jLabel1 = new javax.swing.JLabel();
 65         cityCodeTF = new javax.swing.JTextField();
 66         jLabel2 = new javax.swing.JLabel();
 67         numberFlightsTF = new javax.swing.JTextField();
 68         jLabel3 = new javax.swing.JLabel();
 69         totalPassengersTF = new javax.swing.JTextField();
 70         jLabel4 = new javax.swing.JLabel();
 71         totalRevenueTF = new javax.swing.JTextField();
 72         jLabel5 = new javax.swing.JLabel();
 73         distanceTF = new javax.swing.JTextField();
 74         addButton = new javax.swing.JButton();
 75         jScrollPane2 = new javax.swing.JScrollPane();
 76         rawTable = new javax.swing.JTable();
 77         categoryComboBox = new javax.swing.JComboBox<>();
 78         jLabel6 = new javax.swing.JLabel();
 79         submitButton = new javax.swing.JButton();
 80         jLabel15 = new javax.swing.JLabel();
 81         yesVisa = new javax.swing.JCheckBox();
 82         noVisa = new javax.swing.JCheckBox();
 83         jLabel13 = new javax.swing.JLabel();
 84         cityDestinationTF = new javax.swing.JTextField();
 85         jLabel16 = new javax.swing.JLabel();
 86         countryDestinationTF = new javax.swing.JTextField();
 87         jPanel2 = new javax.swing.JPanel();
 88         jScrollPane1 = new javax.swing.JScrollPane();
 89         jTable1 = new javax.swing.JTable();
 90         jLabel7 = new javax.swing.JLabel();
 91         jComboBox1 = new javax.swing.JComboBox<>();
 92         jLabel8 = new javax.swing.JLabel();
 93         jLabel9 = new javax.swing.JLabel();
 94         jComboBox2 = new javax.swing.JComboBox<>();
 95         jButton2 = new javax.swing.JButton();
 96         jButton4 = new javax.swing.JButton();
 97         jButton6 = new javax.swing.JButton();
 98         jButton7 = new javax.swing.JButton();
 99         jLabel10 = new javax.swing.JLabel();
100         jLabel11 = new javax.swing.JLabel();
101         jLabel12 = new javax.swing.JLabel();
102         jPanel4 = new javax.swing.JPanel();
103         jLabel14 = new javax.swing.JLabel();
104         jTextField6 = new javax.swing.JTextField();
105         jScrollPane3 = new javax.swing.JScrollPane();
106         jTextArea1 = new javax.swing.JTextArea();
107         jButton3 = new javax.swing.JButton();
108         menuBar = new javax.swing.JMenuBar();
109         fileMenu = new javax.swing.JMenu();
110         openMenuItem = new javax.swing.JMenuItem();
111         saveMenuItem = new javax.swing.JMenuItem();
112         saveAsMenuItem = new javax.swing.JMenuItem();
113         exitMenuItem = new javax.swing.JMenuItem();
114         editMenu = new javax.swing.JMenu();
115         cutMenuItem = new javax.swing.JMenuItem();
116         copyMenuItem = new javax.swing.JMenuItem();
117         pasteMenuItem = new javax.swing.JMenuItem();
118         deleteMenuItem = new javax.swing.JMenuItem();
119         helpMenu = new javax.swing.JMenu();
120         contentsMenuItem = new javax.swing.JMenuItem();
121         aboutMenuItem = new javax.swing.JMenuItem();
122 
123         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
124 
125         jLabel1.setText("Flight city code:");
126 
127         cityCodeTF.addActionListener(new java.awt.event.ActionListener() {
128             public void actionPerformed(java.awt.event.ActionEvent evt) {
129                 cityCodeTFActionPerformed(evt);
130             }
131         });
132 
133         jLabel2.setText("Number of flights:");
134 
135         numberFlightsTF.addActionListener(new java.awt.event.ActionListener() {
136             public void actionPerformed(java.awt.event.ActionEvent evt) {
137                 numberFlightsTFActionPerformed(evt);
138             }
139         });
140 
141         jLabel3.setText("Total passenger:");
142 
143         totalPassengersTF.addActionListener(new java.awt.event.ActionListener() {
144             public void actionPerformed(java.awt.event.ActionEvent evt) {
145                 totalPassengersTFActionPerformed(evt);
146             }
147         });
148 
149         jLabel4.setText("Total revenue: ");
150 
151         jLabel5.setText("Distance:");
152 
153         addButton.setText("Add Flight");
154         addButton.addMouseListener(new java.awt.event.MouseAdapter() {
155             public void mouseReleased(java.awt.event.MouseEvent evt) {
156                 addButtonMouseReleased(evt);
157             }
158         });
159         addButton.addActionListener(new java.awt.event.ActionListener() {
160             public void actionPerformed(java.awt.event.ActionEvent evt) {
161                 addButtonActionPerformed(evt);
162             }
163         });
164 
165         rawTable.setModel(new javax.swing.table.DefaultTableModel(
166             new Object [][] {
167                 {null, null, null, null, null, null, null},
168                 {null, null, null, null, null, null, null},
169                 {null, null, null, null, null, null, null},
170                 {null, null, null, null, null, null, null}
171             },
172             new String [] {
173                 "Flight", "Destination", "Distance", "No. of Flt", "Total pas.", "Total Revenue", "Visa required"
174             }
175         ));
176         jScrollPane2.setViewportView(rawTable);
177 
178         categoryComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Domestic ", "International", " " }));
179 
180         jLabel6.setText("International/Domestic:");
181 
182         submitButton.setText("Submit");
183         submitButton.addMouseListener(new java.awt.event.MouseAdapter() {
184             public void mouseReleased(java.awt.event.MouseEvent evt) {
185                 submitButtonMouseReleased(evt);
186             }
187         });
188 
189         jLabel15.setText("Is visa required: ");
190 
191         yesVisa.setText("Yes");
192 
193         noVisa.setText("No");
194 
195         jLabel13.setText("Destination:");
196 
197         jLabel16.setText("Country Destination:");
198 
199         javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
200         jPanel1.setLayout(jPanel1Layout);
201         jPanel1Layout.setHorizontalGroup(
202             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
203             .addGroup(jPanel1Layout.createSequentialGroup()
204                 .addContainerGap()
205                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
206                     .addGroup(jPanel1Layout.createSequentialGroup()
207                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
208                             .addGroup(jPanel1Layout.createSequentialGroup()
209                                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
210                                     .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
211                                     .addComponent(jLabel6)
212                                     .addComponent(jLabel15)
213                                     .addComponent(jLabel1)
214                                     .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
215                                 .addGap(47, 47, 47))
216                             .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
217                                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
218                                     .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
219                                     .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING)
220                                     .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
221                                     .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING))
222                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
223                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
224                             .addComponent(totalRevenueTF, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)
225                             .addComponent(numberFlightsTF, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)
226                             .addComponent(totalPassengersTF, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)
227                             .addComponent(cityCodeTF, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)
228                             .addComponent(categoryComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
229                             .addComponent(distanceTF, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)
230                             .addComponent(cityDestinationTF)
231                             .addComponent(countryDestinationTF)
232                             .addGroup(jPanel1Layout.createSequentialGroup()
233                                 .addComponent(yesVisa)
234                                 .addGap(45, 45, 45)
235                                 .addComponent(noVisa))))
236                     .addGroup(jPanel1Layout.createSequentialGroup()
237                         .addComponent(addButton)
238                         .addGap(46, 46, 46)
239                         .addComponent(submitButton)
240                         .addGap(70, 70, 70)))
241                 .addGap(18, 18, 18)
242                 .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 647, Short.MAX_VALUE)
243                 .addContainerGap())
244         );
245         jPanel1Layout.setVerticalGroup(
246             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
247             .addGroup(jPanel1Layout.createSequentialGroup()
248                 .addGap(84, 84, 84)
249                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
250                     .addGroup(jPanel1Layout.createSequentialGroup()
251                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
252                             .addComponent(jLabel1)
253                             .addComponent(cityCodeTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
254                         .addGap(22, 22, 22)
255                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
256                             .addComponent(jLabel13)
257                             .addComponent(cityDestinationTF, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
258                         .addGap(13, 13, 13)
259                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
260                             .addComponent(jLabel5)
261                             .addComponent(distanceTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
262                         .addGap(24, 24, 24)
263                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
264                             .addComponent(jLabel2)
265                             .addComponent(numberFlightsTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
266                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
267                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
268                             .addComponent(jLabel3)
269                             .addComponent(totalPassengersTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
270                         .addGap(28, 28, 28)
271                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
272                             .addComponent(jLabel4)
273                             .addComponent(totalRevenueTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
274                         .addGap(89, 89, 89)
275                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
276                             .addComponent(jLabel6)
277                             .addComponent(categoryComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
278                         .addGap(18, 18, 18)
279                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
280                             .addComponent(jLabel15)
281                             .addComponent(yesVisa)
282                             .addComponent(noVisa)))
283                     .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 365, javax.swing.GroupLayout.PREFERRED_SIZE))
284                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
285                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
286                     .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
287                     .addComponent(countryDestinationTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
288                 .addGap(23, 23, 23)
289                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
290                     .addComponent(addButton)
291                     .addComponent(submitButton))
292                 .addGap(42, 42, 42))
293         );
294 
295         jTabbedPane1.addTab("Flight December 2018", jPanel1);
296 
297         jTable1.setModel(new javax.swing.table.DefaultTableModel(
298             new Object [][] {
299                 {null, null, null, null},
300                 {null, null, null, null},
301                 {null, null, null, null},
302                 {null, null, null, null}
303             },
304             new String [] {
305                 "Flight", "Average passenger per flight", "Average price (฿)", "Average yield (฿)"
306             }
307         ));
308         jScrollPane1.setViewportView(jTable1);
309 
310         jLabel7.setText("Sort by:");
311 
312         jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Flight", "Average price", "Average yield", "Average pass./ flight" }));
313         jComboBox1.addActionListener(new java.awt.event.ActionListener() {
314             public void actionPerformed(java.awt.event.ActionEvent evt) {
315                 jComboBox1ActionPerformed(evt);
316             }
317         });
318 
319         jLabel8.setText("Column");
320 
321         jLabel9.setText("Order");
322 
323         jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Largest to Smallest", "Smallest to Largest" }));
324         jComboBox2.addActionListener(new java.awt.event.ActionListener() {
325             public void actionPerformed(java.awt.event.ActionEvent evt) {
326                 jComboBox2ActionPerformed(evt);
327             }
328         });
329 
330         jButton2.setText("Display Bar Chart");
331         jButton2.addActionListener(new java.awt.event.ActionListener() {
332             public void actionPerformed(java.awt.event.ActionEvent evt) {
333                 jButton2ActionPerformed(evt);
334             }
335         });
336 
337         jButton4.setText("Sort");
338         jButton4.addActionListener(new java.awt.event.ActionListener() {
339             public void actionPerformed(java.awt.event.ActionEvent evt) {
340                 jButton4ActionPerformed(evt);
341             }
342         });
343 
344         jButton6.setText("Calculate Flight Results");
345 
346         jButton7.setText("Refresh Table");
347 
348         jLabel10.setText("1.");
349 
350         jLabel11.setText("2.");
351 
352         jLabel12.setText("3.");
353 
354         javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
355         jPanel2.setLayout(jPanel2Layout);
356         jPanel2Layout.setHorizontalGroup(
357             jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
358             .addGroup(jPanel2Layout.createSequentialGroup()
359                 .addGap(207, 207, 207)
360                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
361                     .addGroup(jPanel2Layout.createSequentialGroup()
362                         .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
363                             .addGroup(jPanel2Layout.createSequentialGroup()
364                                 .addComponent(jLabel8)
365                                 .addGap(243, 243, 243)
366                                 .addComponent(jLabel9))
367                             .addGroup(jPanel2Layout.createSequentialGroup()
368                                 .addComponent(jLabel7)
369                                 .addGap(18, 18, 18)
370                                 .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
371                                 .addGap(29, 29, 29)
372                                 .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
373                                 .addGap(71, 71, 71)
374                                 .addComponent(jButton4)))
375                         .addGap(0, 0, Short.MAX_VALUE))
376                     .addGroup(jPanel2Layout.createSequentialGroup()
377                         .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 673, javax.swing.GroupLayout.PREFERRED_SIZE)
378                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
379                         .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
380                             .addGroup(jPanel2Layout.createSequentialGroup()
381                                 .addComponent(jLabel10)
382                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
383                                 .addComponent(jButton6))
384                             .addGroup(jPanel2Layout.createSequentialGroup()
385                                 .addComponent(jLabel12)
386                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
387                                 .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE))
388                             .addGroup(jPanel2Layout.createSequentialGroup()
389                                 .addComponent(jLabel11)
390                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
391                                 .addComponent(jButton7)))
392                         .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
393         );
394         jPanel2Layout.setVerticalGroup(
395             jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
396             .addGroup(jPanel2Layout.createSequentialGroup()
397                 .addContainerGap(112, Short.MAX_VALUE)
398                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
399                     .addComponent(jLabel8)
400                     .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
401                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
402                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
403                     .addComponent(jComboBox1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
404                     .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
405                         .addComponent(jButton4)
406                         .addComponent(jLabel7)
407                         .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
408                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
409                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
410                     .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 396, javax.swing.GroupLayout.PREFERRED_SIZE)
411                     .addGroup(jPanel2Layout.createSequentialGroup()
412                         .addGap(22, 22, 22)
413                         .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
414                             .addComponent(jButton6)
415                             .addComponent(jLabel10))
416                         .addGap(87, 87, 87)
417                         .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
418                             .addComponent(jLabel11)
419                             .addComponent(jButton7))
420                         .addGap(93, 93, 93)
421                         .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
422                             .addComponent(jButton2)
423                             .addComponent(jLabel12))))
424                 .addGap(69, 69, 69))
425         );
426 
427         jTabbedPane1.addTab("Flight Route Results", jPanel2);
428 
429         jLabel14.setText("Flight code:");
430 
431         jTextArea1.setEditable(false);
432         jTextArea1.setColumns(20);
433         jTextArea1.setRows(5);
434         jTextArea1.setText("Flight:\n\n\n\n___________________________________________________________________________________\nAverage number of passenger per flight:\n\n\n\n\n___________________________________________________________________________________\nAverage price(฿):\n\n\n\n\n___________________________________________________________________________________\nAverage yield(฿):\n\n");
435         jTextArea1.setBorder(null);
436         jScrollPane3.setViewportView(jTextArea1);
437 
438         jButton3.setText("Search");
439 
440         javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
441         jPanel4.setLayout(jPanel4Layout);
442         jPanel4Layout.setHorizontalGroup(
443             jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
444             .addGroup(jPanel4Layout.createSequentialGroup()
445                 .addContainerGap(324, Short.MAX_VALUE)
446                 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
447                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
448                         .addComponent(jLabel14)
449                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
450                         .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
451                         .addGap(411, 411, 411))
452                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
453                         .addComponent(jButton3)
454                         .addGap(498, 498, 498))
455                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
456                         .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 509, javax.swing.GroupLayout.PREFERRED_SIZE)
457                         .addGap(275, 275, 275))))
458         );
459         jPanel4Layout.setVerticalGroup(
460             jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
461             .addGroup(jPanel4Layout.createSequentialGroup()
462                 .addGap(69, 69, 69)
463                 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
464                     .addComponent(jLabel14)
465                     .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
466                 .addGap(23, 23, 23)
467                 .addComponent(jButton3)
468                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
469                 .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 351, javax.swing.GroupLayout.PREFERRED_SIZE)
470                 .addContainerGap(136, Short.MAX_VALUE))
471         );
472 
473         jTabbedPane1.addTab("Search for Flight", jPanel4);
474 
475         fileMenu.setMnemonic('f');
476         fileMenu.setText("File");
477 
478         openMenuItem.setMnemonic('o');
479         openMenuItem.setText("Open");
480         fileMenu.add(openMenuItem);
481 
482         saveMenuItem.setMnemonic('s');
483         saveMenuItem.setText("Save");
484         fileMenu.add(saveMenuItem);
485 
486         saveAsMenuItem.setMnemonic('a');
487         saveAsMenuItem.setText("Save As ...");
488         saveAsMenuItem.setDisplayedMnemonicIndex(5);
489         fileMenu.add(saveAsMenuItem);
490 
491         exitMenuItem.setMnemonic('x');
492         exitMenuItem.setText("Exit");
493         exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
494             public void actionPerformed(java.awt.event.ActionEvent evt) {
495                 exitMenuItemActionPerformed(evt);
496             }
497         });
498         fileMenu.add(exitMenuItem);
499 
500         menuBar.add(fileMenu);
501 
502         editMenu.setMnemonic('e');
503         editMenu.setText("Edit");
504 
505         cutMenuItem.setMnemonic('t');
506         cutMenuItem.setText("Cut");
507         editMenu.add(cutMenuItem);
508 
509         copyMenuItem.setMnemonic('y');
510         copyMenuItem.setText("Copy");
511         editMenu.add(copyMenuItem);
512 
513         pasteMenuItem.setMnemonic('p');
514         pasteMenuItem.setText("Paste");
515         editMenu.add(pasteMenuItem);
516 
517         deleteMenuItem.setMnemonic('d');
518         deleteMenuItem.setText("Delete");
519         editMenu.add(deleteMenuItem);
520 
521         menuBar.add(editMenu);
522 
523         helpMenu.setMnemonic('h');
524         helpMenu.setText("Help");
525 
526         contentsMenuItem.setMnemonic('c');
527         contentsMenuItem.setText("Contents");
528         helpMenu.add(contentsMenuItem);
529 
530         aboutMenuItem.setMnemonic('a');
531         aboutMenuItem.setText("About");
532         helpMenu.add(aboutMenuItem);
533 
534         menuBar.add(helpMenu);
535 
536         setJMenuBar(menuBar);
537 
538         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
539         getContentPane().setLayout(layout);
540         layout.setHorizontalGroup(
541             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
542             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
543                 .addComponent(jTabbedPane1)
544                 .addContainerGap())
545         );
546         layout.setVerticalGroup(
547             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
548             .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING)
549         );
550 
551         pack();
552     }// </editor-fold>                        
553 
554     private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                             
555         System.exit(0);
556     }                                            
557 
558     private void cityCodeTFActionPerformed(java.awt.event.ActionEvent evt) {                                           
559         // TODO add your handling code here:
560     }                                          
561 
562     private void numberFlightsTFActionPerformed(java.awt.event.ActionEvent evt) {                                                
563         // TODO add your handling code here:
564     }                                               
565 
566     private void totalPassengersTFActionPerformed(java.awt.event.ActionEvent evt) {                                                  
567         // TODO add your handling code here:
568     }                                                 
569 
570     private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {                                           
571         // TODO add your handling code here:
572     }                                          
573 
574     private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {                                          
575         // TODO add your handling code here:
576     }                                         
577 
578     private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {                                         
579         // TODO add your handling code here:
580     }                                        
581 
582     private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
583         // TODO add your handling code here:
584     }                                        
585 
586     private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {                                           
587         // TODO add your handling code here:
588     }       
654 
655     // Variables declaration - do not modify                     
656     private javax.swing.JMenuItem aboutMenuItem;
657     private javax.swing.JButton addButton;
658     private javax.swing.ButtonGroup buttonGroup1;
659     private javax.swing.JComboBox<String> categoryComboBox;
660     private javax.swing.JTextField cityCodeTF;
661     private javax.swing.JTextField cityDestinationTF;
662     private javax.swing.JMenuItem contentsMenuItem;
663     private javax.swing.JMenuItem copyMenuItem;
664     private javax.swing.JTextField countryDestinationTF;
665     private javax.swing.JMenuItem cutMenuItem;
666     private javax.swing.JMenuItem deleteMenuItem;
667     private javax.swing.JTextField distanceTF;
668     private javax.swing.JMenu editMenu;
669     private javax.swing.JMenuItem exitMenuItem;
670     private javax.swing.JMenu fileMenu;
671     private javax.swing.JMenu helpMenu;
672     private javax.swing.JButton jButton2;
673     private javax.swing.JButton jButton3;
674     private javax.swing.JButton jButton4;
675     private javax.swing.JButton jButton6;
676     private javax.swing.JButton jButton7;
677     private javax.swing.JComboBox<String> jComboBox1;
678     private javax.swing.JComboBox<String> jComboBox2;
679     private javax.swing.JLabel jLabel1;
680     private javax.swing.JLabel jLabel10;
681     private javax.swing.JLabel jLabel11;
682     private javax.swing.JLabel jLabel12;
683     private javax.swing.JLabel jLabel13;
684     private javax.swing.JLabel jLabel14;
685     private javax.swing.JLabel jLabel15;
686     private javax.swing.JLabel jLabel16;
687     private javax.swing.JLabel jLabel2;
688     private javax.swing.JLabel jLabel3;
689     private javax.swing.JLabel jLabel4;
690     private javax.swing.JLabel jLabel5;
691     private javax.swing.JLabel jLabel6;
692     private javax.swing.JLabel jLabel7;
693     private javax.swing.JLabel jLabel8;
694     private javax.swing.JLabel jLabel9;
695     private javax.swing.JPanel jPanel1;
696     private javax.swing.JPanel jPanel2;
697     private javax.swing.JPanel jPanel4;
698     private javax.swing.JScrollPane jScrollPane1;
699     private javax.swing.JScrollPane jScrollPane2;
700     private javax.swing.JScrollPane jScrollPane3;
701     private javax.swing.JTabbedPane jTabbedPane1;
702     private javax.swing.JTable jTable1;
703     private javax.swing.JTextArea jTextArea1;
704     private javax.swing.JTextField jTextField6;
705     private javax.swing.JMenuBar menuBar;
706     private javax.swing.JCheckBox noVisa;
707     private javax.swing.JTextField numberFlightsTF;
708     private javax.swing.JMenuItem openMenuItem;
709     private javax.swing.JMenuItem pasteMenuItem;
710     private javax.swing.JTable rawTable;
711     private javax.swing.JMenuItem saveAsMenuItem;
712     private javax.swing.JMenuItem saveMenuItem;
713     private javax.swing.JButton submitButton;
714     private javax.swing.JTextField totalPassengersTF;
715     private javax.swing.JTextField totalRevenueTF;
716     private javax.swing.JCheckBox yesVisa;
717     // End of variables declaration                   
718 
719 }
720