/Users/johnr/Desktop/IA Submissions/IA Final Submission 000307-0023 - Jimmy/Product/ProductDataBase/src/ProductDataBase/MainGUI.java
   1 /*
   2  * To change this license header, choose License Headers in Project Properties.
   3  * To change this template file, choose Tools | Templates
   4  * and open the template in the editor.
   5  */
   6 package ProductDataBase;
   7 
   8 import java.util.GregorianCalendar;
   9 
  10 /**
  11  *
  12  * @author 15417
  13  */
  14 public class MainGUI extends javax.swing.JFrame
  15 {
  16 //Possible Extensibilities:
  17 //  Gregorian Calendar for more accurate dates (days in a month)
  18 //  estimated order completetion time for more detailed planning to the firm
  19 //   have it so that every time a product model is edited it also updates the purchase order related to that product model
  20 //   create more sort and search classes so there are more ways to organize data
  21 //
  22 //
  23 //
  24 //
  25 //
  26 //
  27 //
  28     
  29     private Product[] productArray = new Product[50];
  30     private int productcounter = 0;
  31     private int ordercounter = 0;
  32     private PurchaseOrder[] purchaseOrderArray = new PurchaseOrder[50];
  33 //creates array that will store information on the product and purchase orders
  34 
  35     /**
  36      * Creates new form MainGUI
  37      */
  38     public MainGUI()
  39     {//intializes arrays.
  40         initComponents();
  41         for (int i = 0; i < 50; i++)
  42         {
  43             productArray[i] = new Product();
  44         }
  45         for (int i = 0; i < 50; i++)
  46         {
  47             purchaseOrderArray[i] = new PurchaseOrder();
  48         }
  49     }
  50 
  51     /**
  52      * This method is called from within the constructor to initialize the form.
  53      * WARNING: Do NOT modify this code. The content of this method is always
  54      * regenerated by the Form Editor.
  55      */
  56     @SuppressWarnings("unchecked")
  57     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  58     private void initComponents()
  59     {
  60 
  61         jTabbedPane1 = new javax.swing.JTabbedPane();
  62         jPanel1 = new javax.swing.JPanel();
  63         UnitVolumeTextField = new javax.swing.JTextField();
  64         jLabel17 = new javax.swing.JLabel();
  65         jLabel12 = new javax.swing.JLabel();
  66         PurchaseOrderTextField = new javax.swing.JTextField();
  67         PurchaseOrderNumberTextField = new javax.swing.JTextField();
  68         jLabel13 = new javax.swing.JLabel();
  69         PurchaseOrderIDTextField = new javax.swing.JTextField();
  70         ProductRefreshButton = new javax.swing.JButton();
  71         ProductSortButton = new javax.swing.JButton();
  72         SetNewProductData = new javax.swing.JButton();
  73         ProductModelLabel = new javax.swing.JLabel();
  74         jLabel14 = new javax.swing.JLabel();
  75         jLabel2 = new javax.swing.JLabel();
  76         ProductModelTextField = new javax.swing.JTextField();
  77         jLabel6 = new javax.swing.JLabel();
  78         SearchProductModelField = new javax.swing.JTextField();
  79         ProductionTimeTextField = new javax.swing.JTextField();
  80         AddProductButton = new javax.swing.JButton();
  81         SearchButton = new javax.swing.JButton();
  82         jLabel7 = new javax.swing.JLabel();
  83         jScrollPane1 = new javax.swing.JScrollPane();
  84         ProductDisplayTBL = new javax.swing.JTable();
  85         EditProductionTimeField = new javax.swing.JTextField();
  86         EditProductionCostField = new javax.swing.JTextField();
  87         jLabel3 = new javax.swing.JLabel();
  88         jLabel15 = new javax.swing.JLabel();
  89         ProductionCostTextField = new javax.swing.JTextField();
  90         jLabel8 = new javax.swing.JLabel();
  91         jLabel16 = new javax.swing.JLabel();
  92         jLabel9 = new javax.swing.JLabel();
  93         StorageVolumeTextField = new javax.swing.JTextField();
  94         jLabel10 = new javax.swing.JLabel();
  95         jLabel11 = new javax.swing.JLabel();
  96         AddOrderButton = new javax.swing.JButton();
  97         OldEstimatedProductionTimeTextField = new javax.swing.JTextField();
  98         jLabel18 = new javax.swing.JLabel();
  99         jLabel19 = new javax.swing.JLabel();
 100         OldEstimatedProductionCostTextField = new javax.swing.JTextField();
 101         OldProductVolumeTextField = new javax.swing.JTextField();
 102         jLabel20 = new javax.swing.JLabel();
 103         NewProductVolumeTextField = new javax.swing.JTextField();
 104         jLabel21 = new javax.swing.JLabel();
 105         YearBox = new javax.swing.JComboBox<>();
 106         MonthBox = new javax.swing.JComboBox<>();
 107         DateBox = new javax.swing.JComboBox<>();
 108         jLabel23 = new javax.swing.JLabel();
 109         jLabel24 = new javax.swing.JLabel();
 110         jLabel25 = new javax.swing.JLabel();
 111         jPanel2 = new javax.swing.JPanel();
 112         jScrollPane2 = new javax.swing.JScrollPane();
 113         OrderDisplayTBL = new javax.swing.JTable();
 114         OrderRefreshButton = new javax.swing.JButton();
 115         ModelNumberSort = new javax.swing.JButton();
 116         jLabel4 = new javax.swing.JLabel();
 117         PurchaseOrderNumberSort = new javax.swing.JButton();
 118         PurchaseOrderIDSort = new javax.swing.JButton();
 119 
 120         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
 121 
 122         UnitVolumeTextField.addActionListener(new java.awt.event.ActionListener()
 123         {
 124             public void actionPerformed(java.awt.event.ActionEvent evt)
 125             {
 126                 UnitVolumeTextFieldActionPerformed(evt);
 127             }
 128         });
 129 
 130         jLabel17.setText("# of Units");
 131 
 132         jLabel12.setText("Purchase Order #");
 133 
 134         PurchaseOrderTextField.addActionListener(new java.awt.event.ActionListener()
 135         {
 136             public void actionPerformed(java.awt.event.ActionEvent evt)
 137             {
 138                 PurchaseOrderTextFieldActionPerformed(evt);
 139             }
 140         });
 141 
 142         PurchaseOrderNumberTextField.addActionListener(new java.awt.event.ActionListener()
 143         {
 144             public void actionPerformed(java.awt.event.ActionEvent evt)
 145             {
 146                 PurchaseOrderNumberTextFieldActionPerformed(evt);
 147             }
 148         });
 149 
 150         jLabel13.setText("Purchase Order ID");
 151 
 152         PurchaseOrderIDTextField.addActionListener(new java.awt.event.ActionListener()
 153         {
 154             public void actionPerformed(java.awt.event.ActionEvent evt)
 155             {
 156                 PurchaseOrderIDTextFieldActionPerformed(evt);
 157             }
 158         });
 159 
 160         ProductRefreshButton.setText("Refresh");
 161         ProductRefreshButton.addMouseListener(new java.awt.event.MouseAdapter()
 162         {
 163             public void mouseReleased(java.awt.event.MouseEvent evt)
 164             {
 165                 ProductRefreshButtonMouseReleased(evt);
 166             }
 167         });
 168         ProductRefreshButton.addActionListener(new java.awt.event.ActionListener()
 169         {
 170             public void actionPerformed(java.awt.event.ActionEvent evt)
 171             {
 172                 ProductRefreshButtonActionPerformed(evt);
 173             }
 174         });
 175 
 176         ProductSortButton.setText("Sort");
 177         ProductSortButton.addMouseListener(new java.awt.event.MouseAdapter()
 178         {
 179             public void mouseReleased(java.awt.event.MouseEvent evt)
 180             {
 181                 ProductSortButtonMouseReleased(evt);
 182             }
 183         });
 184         ProductSortButton.addActionListener(new java.awt.event.ActionListener()
 185         {
 186             public void actionPerformed(java.awt.event.ActionEvent evt)
 187             {
 188                 ProductSortButtonActionPerformed(evt);
 189             }
 190         });
 191 
 192         SetNewProductData.setText("Set");
 193         SetNewProductData.addMouseListener(new java.awt.event.MouseAdapter()
 194         {
 195             public void mouseReleased(java.awt.event.MouseEvent evt)
 196             {
 197                 SetNewProductDataMouseReleased(evt);
 198             }
 199         });
 200         SetNewProductData.addActionListener(new java.awt.event.ActionListener()
 201         {
 202             public void actionPerformed(java.awt.event.ActionEvent evt)
 203             {
 204                 SetNewProductDataActionPerformed(evt);
 205             }
 206         });
 207 
 208         ProductModelLabel.setText("Product Model");
 209 
 210         jLabel14.setText("Edit Product Model");
 211 
 212         jLabel2.setText("Estimated Production Time");
 213 
 214         ProductModelTextField.addActionListener(new java.awt.event.ActionListener()
 215         {
 216             public void actionPerformed(java.awt.event.ActionEvent evt)
 217             {
 218                 ProductModelTextFieldActionPerformed(evt);
 219             }
 220         });
 221 
 222         jLabel6.setText("Product Model:");
 223 
 224         SearchProductModelField.addActionListener(new java.awt.event.ActionListener()
 225         {
 226             public void actionPerformed(java.awt.event.ActionEvent evt)
 227             {
 228                 SearchProductModelFieldActionPerformed(evt);
 229             }
 230         });
 231 
 232         ProductionTimeTextField.addActionListener(new java.awt.event.ActionListener()
 233         {
 234             public void actionPerformed(java.awt.event.ActionEvent evt)
 235             {
 236                 ProductionTimeTextFieldActionPerformed(evt);
 237             }
 238         });
 239 
 240         AddProductButton.setText("Add entry");
 241         AddProductButton.addMouseListener(new java.awt.event.MouseAdapter()
 242         {
 243             public void mouseReleased(java.awt.event.MouseEvent evt)
 244             {
 245                 AddProductButtonMouseReleased(evt);
 246             }
 247         });
 248         AddProductButton.addActionListener(new java.awt.event.ActionListener()
 249         {
 250             public void actionPerformed(java.awt.event.ActionEvent evt)
 251             {
 252                 AddProductButtonActionPerformed(evt);
 253             }
 254         });
 255 
 256         SearchButton.setText("Search");
 257         SearchButton.addMouseListener(new java.awt.event.MouseAdapter()
 258         {
 259             public void mouseReleased(java.awt.event.MouseEvent evt)
 260             {
 261                 SearchButtonMouseReleased(evt);
 262             }
 263         });
 264         SearchButton.addActionListener(new java.awt.event.ActionListener()
 265         {
 266             public void actionPerformed(java.awt.event.ActionEvent evt)
 267             {
 268                 SearchButtonActionPerformed(evt);
 269             }
 270         });
 271 
 272         jLabel7.setText("New Production Time:");
 273 
 274         ProductDisplayTBL.setModel(new javax.swing.table.DefaultTableModel(
 275             new Object [][]
 276             {
 277                 {null, null, null, null},
 278                 {null, null, null, null},
 279                 {null, null, null, null},
 280                 {null, null, null, null},
 281                 {null, null, null, null},
 282                 {null, null, null, null},
 283                 {null, null, null, null},
 284                 {null, null, null, null},
 285                 {null, null, null, null},
 286                 {null, null, null, null},
 287                 {null, null, null, null},
 288                 {null, null, null, null},
 289                 {null, null, null, null},
 290                 {null, null, null, null},
 291                 {null, null, null, null},
 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             },
 328             new String []
 329             {
 330                 "ProductModel", "Volume", "Cost", "Time"
 331             }
 332         ));
 333         jScrollPane1.setViewportView(ProductDisplayTBL);
 334 
 335         EditProductionTimeField.addActionListener(new java.awt.event.ActionListener()
 336         {
 337             public void actionPerformed(java.awt.event.ActionEvent evt)
 338             {
 339                 EditProductionTimeFieldActionPerformed(evt);
 340             }
 341         });
 342 
 343         EditProductionCostField.addActionListener(new java.awt.event.ActionListener()
 344         {
 345             public void actionPerformed(java.awt.event.ActionEvent evt)
 346             {
 347                 EditProductionCostFieldActionPerformed(evt);
 348             }
 349         });
 350 
 351         jLabel3.setText("Display Table");
 352 
 353         jLabel15.setText("New  Production Cost:");
 354 
 355         ProductionCostTextField.addActionListener(new java.awt.event.ActionListener()
 356         {
 357             public void actionPerformed(java.awt.event.ActionEvent evt)
 358             {
 359                 ProductionCostTextFieldActionPerformed(evt);
 360             }
 361         });
 362 
 363         jLabel8.setText("Estimated Production Cost");
 364 
 365         jLabel16.setText("Storage Volume");
 366 
 367         jLabel9.setText("Add New Product Model to Database");
 368 
 369         StorageVolumeTextField.addActionListener(new java.awt.event.ActionListener()
 370         {
 371             public void actionPerformed(java.awt.event.ActionEvent evt)
 372             {
 373                 StorageVolumeTextFieldActionPerformed(evt);
 374             }
 375         });
 376 
 377         jLabel10.setText("Purchase Order");
 378 
 379         jLabel11.setText("Product Model");
 380 
 381         AddOrderButton.setText("Add entry");
 382         AddOrderButton.addActionListener(new java.awt.event.ActionListener()
 383         {
 384             public void actionPerformed(java.awt.event.ActionEvent evt)
 385             {
 386                 AddOrderButtonActionPerformed(evt);
 387             }
 388         });
 389 
 390         jLabel18.setText("Old Estimated Production Time:");
 391 
 392         jLabel19.setText("Old Estimated Production Cost:");
 393 
 394         jLabel20.setText("Old Product Volume:");
 395 
 396         jLabel21.setText("New Product Volume:");
 397 
 398         YearBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025", " " }));
 399 
 400         MonthBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }));
 401 
 402         DateBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
 403 
 404         jLabel23.setText("Year");
 405 
 406         jLabel24.setText("Month");
 407 
 408         jLabel25.setText("Day");
 409 
 410         javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
 411         jPanel1.setLayout(jPanel1Layout);
 412         jPanel1Layout.setHorizontalGroup(
 413             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 414             .addGroup(jPanel1Layout.createSequentialGroup()
 415                 .addContainerGap()
 416                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 417                     .addGroup(jPanel1Layout.createSequentialGroup()
 418                         .addGap(164, 164, 164)
 419                         .addComponent(jLabel14))
 420                     .addGroup(jPanel1Layout.createSequentialGroup()
 421                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 422                             .addGroup(jPanel1Layout.createSequentialGroup()
 423                                 .addComponent(jLabel6)
 424                                 .addGap(18, 18, 18)
 425                                 .addComponent(SearchProductModelField, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
 426                             .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 427                                 .addComponent(SearchButton)
 428                                 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
 429                                     .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 430                                         .addGroup(jPanel1Layout.createSequentialGroup()
 431                                             .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 432                                                 .addGroup(jPanel1Layout.createSequentialGroup()
 433                                                     .addGap(5, 5, 5)
 434                                                     .addComponent(jLabel18))
 435                                                 .addComponent(jLabel19))
 436                                             .addGap(20, 20, 20))
 437                                         .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
 438                                             .addComponent(jLabel20)
 439                                             .addGap(18, 18, 18)))
 440                                     .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
 441                                         .addComponent(OldEstimatedProductionCostTextField)
 442                                         .addComponent(OldEstimatedProductionTimeTextField)
 443                                         .addComponent(OldProductVolumeTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)))))
 444                         .addGap(18, 18, 18)
 445                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
 446                             .addComponent(SetNewProductData)
 447                             .addGroup(jPanel1Layout.createSequentialGroup()
 448                                 .addComponent(jLabel15)
 449                                 .addGap(22, 22, 22)
 450                                 .addComponent(EditProductionCostField))
 451                             .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
 452                                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 453                                     .addGroup(jPanel1Layout.createSequentialGroup()
 454                                         .addComponent(jLabel7)
 455                                         .addGap(20, 20, 20))
 456                                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
 457                                         .addComponent(jLabel21)
 458                                         .addGap(18, 18, 18)))
 459                                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 460                                     .addComponent(NewProductVolumeTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
 461                                     .addComponent(EditProductionTimeField, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))))))
 462                 .addContainerGap(260, Short.MAX_VALUE))
 463             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
 464                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 465                     .addGroup(jPanel1Layout.createSequentialGroup()
 466                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 467                             .addGroup(jPanel1Layout.createSequentialGroup()
 468                                 .addGap(60, 60, 60)
 469                                 .addComponent(jLabel9))
 470                             .addGroup(jPanel1Layout.createSequentialGroup()
 471                                 .addGap(19, 19, 19)
 472                                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 473                                     .addComponent(AddProductButton)
 474                                     .addGroup(jPanel1Layout.createSequentialGroup()
 475                                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 476                                             .addComponent(jLabel16)
 477                                             .addComponent(ProductModelLabel)
 478                                             .addComponent(jLabel2)
 479                                             .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING))
 480                                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 481                                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 482                                             .addComponent(ProductionTimeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
 483                                             .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
 484                                                 .addComponent(ProductModelTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
 485                                                 .addComponent(StorageVolumeTextField))
 486                                             .addComponent(ProductionCostTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))))))
 487                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
 488                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 489                             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
 490                                 .addComponent(jLabel11)
 491                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 492                                 .addComponent(PurchaseOrderTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
 493                             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
 494                                 .addComponent(jLabel17)
 495                                 .addGap(18, 18, 18)
 496                                 .addComponent(UnitVolumeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE))
 497                             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
 498                                 .addComponent(jLabel10)
 499                                 .addGap(10, 10, 10))))
 500                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
 501                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 502                             .addComponent(jLabel13)
 503                             .addComponent(jLabel12)
 504                             .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
 505                                 .addContainerGap()
 506                                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 507                                     .addComponent(ProductSortButton)
 508                                     .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
 509                                         .addGroup(jPanel1Layout.createSequentialGroup()
 510                                             .addGap(58, 58, 58)
 511                                             .addComponent(jLabel3)
 512                                             .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 513                                             .addComponent(ProductRefreshButton))
 514                                         .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 488, javax.swing.GroupLayout.PREFERRED_SIZE)))
 515                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
 516                                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 517                                     .addComponent(jLabel23, javax.swing.GroupLayout.Alignment.TRAILING)
 518                                     .addComponent(jLabel24, javax.swing.GroupLayout.Alignment.TRAILING)
 519                                     .addComponent(jLabel25, javax.swing.GroupLayout.Alignment.TRAILING))))
 520                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 521                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 522                             .addComponent(YearBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 523                             .addComponent(MonthBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 524                             .addComponent(DateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 525                             .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 526                                 .addComponent(AddOrderButton)
 527                                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
 528                                     .addComponent(PurchaseOrderNumberTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)
 529                                     .addComponent(PurchaseOrderIDTextField))))))
 530                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
 531         );
 532         jPanel1Layout.setVerticalGroup(
 533             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 534             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
 535                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 536                     .addGroup(jPanel1Layout.createSequentialGroup()
 537                         .addGap(16, 16, 16)
 538                         .addComponent(jLabel10)
 539                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 540                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 541                             .addComponent(jLabel11)
 542                             .addComponent(PurchaseOrderTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 543                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 544                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 545                             .addComponent(jLabel17)
 546                             .addComponent(UnitVolumeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
 547                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 548                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 549                             .addComponent(PurchaseOrderNumberTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 550                             .addComponent(jLabel12))
 551                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 552                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 553                             .addComponent(PurchaseOrderIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 554                             .addComponent(jLabel13)))
 555                     .addGroup(jPanel1Layout.createSequentialGroup()
 556                         .addContainerGap()
 557                         .addComponent(jLabel9)
 558                         .addGap(4, 4, 4)
 559                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 560                             .addComponent(ProductModelLabel)
 561                             .addComponent(ProductModelTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 562                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 563                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 564                             .addComponent(jLabel16)
 565                             .addComponent(StorageVolumeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 566                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 567                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 568                             .addComponent(ProductionTimeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 569                             .addComponent(jLabel2))
 570                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 571                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 572                             .addComponent(ProductionCostTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 573                             .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
 574                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 575                         .addComponent(AddProductButton)))
 576                 .addGap(17, 17, 17)
 577                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
 578                     .addGroup(jPanel1Layout.createSequentialGroup()
 579                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 580                             .addComponent(YearBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 581                             .addComponent(jLabel23))
 582                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 583                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 584                             .addComponent(MonthBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 585                             .addComponent(jLabel24))
 586                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 587                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 588                             .addComponent(DateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 589                             .addComponent(jLabel25))
 590                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 591                         .addComponent(AddOrderButton)
 592                         .addGap(88, 88, 88))
 593                     .addGroup(jPanel1Layout.createSequentialGroup()
 594                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 595                             .addComponent(ProductRefreshButton)
 596                             .addComponent(jLabel3))
 597                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 598                         .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
 599                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
 600                         .addComponent(ProductSortButton)
 601                         .addGap(18, 18, 18)))
 602                 .addComponent(jLabel14)
 603                 .addGap(5, 5, 5)
 604                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 605                     .addComponent(jLabel6)
 606                     .addComponent(SearchProductModelField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 607                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 608                 .addComponent(SearchButton)
 609                 .addGap(8, 8, 8)
 610                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 611                     .addGroup(jPanel1Layout.createSequentialGroup()
 612                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 613                             .addComponent(OldProductVolumeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 614                             .addComponent(jLabel20))
 615                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 616                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 617                             .addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING)
 618                             .addComponent(OldEstimatedProductionTimeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 619                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 620                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 621                             .addComponent(jLabel19)
 622                             .addComponent(OldEstimatedProductionCostTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
 623                     .addGroup(jPanel1Layout.createSequentialGroup()
 624                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 625                             .addComponent(NewProductVolumeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 626                             .addComponent(jLabel21))
 627                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 628                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 629                             .addComponent(jLabel7)
 630                             .addComponent(EditProductionTimeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 631                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 632                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 633                             .addComponent(jLabel15)
 634                             .addComponent(EditProductionCostField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 635                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 636                         .addComponent(SetNewProductData)))
 637                 .addContainerGap(292, Short.MAX_VALUE))
 638         );
 639 
 640         jTabbedPane1.addTab("Information Input", jPanel1);
 641 
 642         OrderDisplayTBL.setModel(new javax.swing.table.DefaultTableModel(
 643             new Object [][]
 644             {
 645                 {null, null, null, null, null, null, null},
 646                 {null, null, null, null, null, null, null},
 647                 {null, null, null, null, null, null, null},
 648                 {null, null, null, null, null, null, null},
 649                 {null, null, null, null, null, null, null},
 650                 {null, null, null, null, null, null, null}
 651             },
 652             new String []
 653             {
 654                 "Model Number", "Units Ordered", "Total Production Cost", "Total Volume", "Order ID", "Order Number", "Order Recieved"
 655             }
 656         )
 657         {
 658             Class[] types = new Class []
 659             {
 660                 java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Integer.class
 661             };
 662             boolean[] canEdit = new boolean []
 663             {
 664                 false, false, false, false, false, false, false
 665             };
 666 
 667             public Class getColumnClass(int columnIndex)
 668             {
 669                 return types [columnIndex];
 670             }
 671 
 672             public boolean isCellEditable(int rowIndex, int columnIndex)
 673             {
 674                 return canEdit [columnIndex];
 675             }
 676         });
 677         jScrollPane2.setViewportView(OrderDisplayTBL);
 678 
 679         OrderRefreshButton.setText("Refresh");
 680         OrderRefreshButton.addActionListener(new java.awt.event.ActionListener()
 681         {
 682             public void actionPerformed(java.awt.event.ActionEvent evt)
 683             {
 684                 OrderRefreshButtonActionPerformed(evt);
 685             }
 686         });
 687 
 688         ModelNumberSort.setText("ModelNumber");
 689         ModelNumberSort.addActionListener(new java.awt.event.ActionListener()
 690         {
 691             public void actionPerformed(java.awt.event.ActionEvent evt)
 692             {
 693                 ModelNumberSortActionPerformed(evt);
 694             }
 695         });
 696 
 697         jLabel4.setText("Sort by:");
 698 
 699         PurchaseOrderNumberSort.setText("Purchase Order Number");
 700         PurchaseOrderNumberSort.addActionListener(new java.awt.event.ActionListener()
 701         {
 702             public void actionPerformed(java.awt.event.ActionEvent evt)
 703             {
 704                 PurchaseOrderNumberSortActionPerformed(evt);
 705             }
 706         });
 707 
 708         PurchaseOrderIDSort.setText("Purchase Order ID");
 709         PurchaseOrderIDSort.addActionListener(new java.awt.event.ActionListener()
 710         {
 711             public void actionPerformed(java.awt.event.ActionEvent evt)
 712             {
 713                 PurchaseOrderIDSortActionPerformed(evt);
 714             }
 715         });
 716 
 717         javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
 718         jPanel2.setLayout(jPanel2Layout);
 719         jPanel2Layout.setHorizontalGroup(
 720             jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 721             .addGroup(jPanel2Layout.createSequentialGroup()
 722                 .addGap(0, 12, Short.MAX_VALUE)
 723                 .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 978, javax.swing.GroupLayout.PREFERRED_SIZE))
 724             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
 725                 .addContainerGap()
 726                 .addComponent(OrderRefreshButton)
 727                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
 728                 .addComponent(jLabel4)
 729                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 730                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 731                     .addComponent(PurchaseOrderIDSort)
 732                     .addComponent(PurchaseOrderNumberSort)
 733                     .addComponent(ModelNumberSort)))
 734         );
 735         jPanel2Layout.setVerticalGroup(
 736             jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 737             .addGroup(jPanel2Layout.createSequentialGroup()
 738                 .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 462, javax.swing.GroupLayout.PREFERRED_SIZE)
 739                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 740                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 741                     .addComponent(ModelNumberSort)
 742                     .addComponent(OrderRefreshButton)
 743                     .addComponent(jLabel4))
 744                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 745                 .addComponent(PurchaseOrderNumberSort)
 746                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 747                 .addComponent(PurchaseOrderIDSort)
 748                 .addGap(0, 352, Short.MAX_VALUE))
 749         );
 750 
 751         jTabbedPane1.addTab("Purchase Order Display", jPanel2);
 752 
 753         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
 754         getContentPane().setLayout(layout);
 755         layout.setHorizontalGroup(
 756             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 757             .addGroup(layout.createSequentialGroup()
 758                 .addContainerGap()
 759                 .addComponent(jTabbedPane1)
 760                 .addGap(177, 177, 177))
 761         );
 762         layout.setVerticalGroup(
 763             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 764             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
 765                 .addContainerGap(26, Short.MAX_VALUE)
 766                 .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 971, javax.swing.GroupLayout.PREFERRED_SIZE)
 767                 .addContainerGap())
 768         );
 769 
 770         pack();
 771     }// </editor-fold>                        
 772 
 773     private void AddOrderButtonActionPerformed(java.awt.event.ActionEvent evt)                                               
 774     {                                                   
 775         double ProductionCost = 0;
 776         double StorageVolume = 0;
 777         double ProductionTime = 0;
 778         for (int e = 0; e < productArray.length; e++) //finds and matches model number from purchase order and product
 779         {
 780             if (Double.parseDouble(PurchaseOrderTextField.getText()) == productArray[e].getModelNumber())
 781             { //draws on components from product array and calculates components in purchase order array
 782                 ProductionCost = (int) (Double.parseDouble(UnitVolumeTextField.getText()) * productArray[e].getProductionCost());
 783                 StorageVolume = (int) (Double.parseDouble(UnitVolumeTextField.getText()) * productArray[e].getVolume());
 784                 //ProductionTime = (int) (Double.parseDouble(UnitVolumeTextField.getText()) * productArray[e].getProductionTime());
 785                 //production time can be added for extensibility when expected delivery date may be needed.
 786             } else
 787             {
 788             }
 789 
 790         }
 791         
 792         int year = Integer.parseInt(YearBox.getSelectedItem() + "");
 793         int month = Integer.parseInt(MonthBox.getSelectedItem() + "");
 794         int date = Integer.parseInt(DateBox.getSelectedItem() + "");
 795         String fullDate = month + "/" + date + "/" + year;
 796        
 797         purchaseOrderArray[ordercounter] = new PurchaseOrder(
 798                 Double.parseDouble(PurchaseOrderTextField.getText()),
 799                 Double.parseDouble(UnitVolumeTextField.getText()),
 800                 ProductionCost,
 801                 StorageVolume,
 802                 Double.parseDouble(PurchaseOrderIDTextField.getText()),
 803                 Double.parseDouble(PurchaseOrderNumberTextField.getText()),
 804                 fullDate); //setting up array
 805         //System.out.println(MonthBox.getItemAt(0)); was used to check if gregoriancalendar was working
 806         
 807         
 808         ordercounter++;
 809         PurchaseOrderTextField.setText(""); //clears all user input fields so that next item is ready to be put in array
 810         UnitVolumeTextField.setText("");
 811         PurchaseOrderNumberTextField.setText("");
 812         PurchaseOrderIDTextField.setText("");
 813 
 814         // TODO add your handling code here:
 815     }                                              
 816 
 817     private void StorageVolumeTextFieldActionPerformed(java.awt.event.ActionEvent evt)                                                       
 818     {                                                           
 819         // TODO add your handling code here:
 820     }                                                      
 821 
 822     private void ProductionCostTextFieldActionPerformed(java.awt.event.ActionEvent evt)                                                        
 823     {                                                            
 824         // TODO add your handling code here:
 825     }                                                       
 826 
 827     private void EditProductionCostFieldActionPerformed(java.awt.event.ActionEvent evt)                                                        
 828     {                                                            
 829         // TODO add your handling code here:
 830     }                                                       
 831 
 832     private void EditProductionTimeFieldActionPerformed(java.awt.event.ActionEvent evt)                                                        
 833     {                                                            
 834         // TODO add your handling code here:
 835     }                                                       
 836 
 837     private void SearchButtonActionPerformed(java.awt.event.ActionEvent evt)                                             
 838     {                                                 
 839         for (int e = 0; e < productArray.length; e++)
 840         {
 841             // System.out.println(SearchProductModelField.getText());
 842             //  System.out.println(productArray[e].getModelNumber());
 843             // System.out.println("");
 844             if (Double.parseDouble(SearchProductModelField.getText()) == productArray[e].getModelNumber()) //search function that matches user input with array
 845             {
 846                 OldProductVolumeTextField.setText(productArray[e].getVolume() + "");
 847                 OldEstimatedProductionCostTextField.setText(productArray[e].getProductionCost() + "");
 848                 OldEstimatedProductionTimeTextField.setText(productArray[e].getProductionTime() + "");
 849             } else
 850             {
 851 
 852             }
 853         }
 854         // TODO add your handling code here:
 855     }                                            
 856 
 857     private void SearchButtonMouseReleased(java.awt.event.MouseEvent evt)                                           
 858     {                                               
 859         // TODO add your handling code here:
 860 
 861         //  cityArray.add(new NomadCity(cityTextfield.getText(), Integer.parseInt(scoreTextfield.getText());
 862     }                                          
 863 
 864     private void AddProductButtonActionPerformed(java.awt.event.ActionEvent evt)                                                 
 865     {                                                     
 866 
 867         // TODO add your handling code here:
 868     }                                                
 869 
 870     private void AddProductButtonMouseReleased(java.awt.event.MouseEvent evt)                                               
 871     {                                                   
 872         // TODO add your handling code here:
 873         productArray[productcounter] = new Product(
 874                 Double.parseDouble(ProductModelTextField.getText()), //takes user input and adds into array
 875                 Double.parseDouble(StorageVolumeTextField.getText()),
 876                 Double.parseDouble(ProductionCostTextField.getText()),
 877                 Double.parseDouble(ProductionTimeTextField.getText()));
 878         productcounter++;
 879         ProductModelTextField.setText(""); //clears user input fields
 880         StorageVolumeTextField.setText("");
 881         ProductionTimeTextField.setText("");
 882         ProductionCostTextField.setText("");
 883     }                                              
 884 
 885     private void ProductionTimeTextFieldActionPerformed(java.awt.event.ActionEvent evt)                                                        
 886     {                                                            
 887         // TODO add your handling code here:
 888     }                                                       
 889 
 890     private void SearchProductModelFieldActionPerformed(java.awt.event.ActionEvent evt)                                                        
 891     {                                                            
 892         // TODO add your handling code here:
 893     }                                                       
 894 
 895     private void ProductModelTextFieldActionPerformed(java.awt.event.ActionEvent evt)                                                      
 896     {                                                          
 897         // TODO add your handling code here:
 898     }                                                     
 899 
 900     private void SetNewProductDataActionPerformed(java.awt.event.ActionEvent evt)                                                  
 901     {                                                      
 902         for (int e = 0; e < productcounter; e++) //similar to previous search loops, this one is meant to allow user to edit items in array.
 903         {
 904             if (Double.parseDouble(SearchProductModelField.getText()) == productArray[e].getModelNumber())
 905             {
 906                 productArray[e] = new Product(
 907                         Double.parseDouble(SearchProductModelField.getText()),
 908                         Double.parseDouble(NewProductVolumeTextField.getText()),
 909                         Double.parseDouble(EditProductionTimeField.getText()),
 910                         Double.parseDouble(EditProductionCostField.getText()));
 911             } else
 912             {
 913 
 914             }
 915         }
 916         SearchProductModelField.setText("");
 917         OldProductVolumeTextField.setText("");
 918         OldEstimatedProductionTimeTextField.setText("");
 919         OldEstimatedProductionCostTextField.setText("");
 920         NewProductVolumeTextField.setText("");
 921         EditProductionTimeField.setText("");
 922         EditProductionCostField.setText("");
 923 
 924         // TODO add your handling code here:
 925     }                                                 
 926 
 927     private void SetNewProductDataMouseReleased(java.awt.event.MouseEvent evt)                                                
 928     {                                                    
 929         // TODO add your handling code here:
 930     }                                               
 931 
 932     private void ProductSortButtonActionPerformed(java.awt.event.ActionEvent evt)                                                  
 933     {                                                      
 934 
 935         SortandSearchClass S = new SortandSearchClass(); //sorts display table
 936         S.selectionSortOfProductModel(productArray, productcounter);
 937         for (int i = 0; i < productcounter; i++)
 938         {
 939             ProductDisplayTBL.setValueAt(productArray[i].getModelNumber(), i, 0);
 940             ProductDisplayTBL.setValueAt(productArray[i].getVolume(), i, 1);
 941             ProductDisplayTBL.setValueAt(productArray[i].getProductionCost(), i, 2);
 942             ProductDisplayTBL.setValueAt(productArray[i].getProductionTime(), i, 3);
 943         }
 944         // System.out.println("at end of sortButton"); used for bug testing
 945         // TODO add your handling code here:
 946     }                                                 
 947 
 948     private void ProductSortButtonMouseReleased(java.awt.event.MouseEvent evt)                                                
 949     {                                                    
 950         // TODO add your handling code here:
 951 
 952         {
 953             //         name of the table.setValueAt(add what , row,  column);
 954 
 955         }
 956     }                                               
 957 
 958     private void ProductRefreshButtonActionPerformed(java.awt.event.ActionEvent evt)                                                     
 959     {                                                         
 960 
 961         // TODO add your handling code here:
 962     }                                                    
 963 
 964     private void ProductRefreshButtonMouseReleased(java.awt.event.MouseEvent evt)                                                   
 965     {                                                       
 966         // TODO add your handling code here:
 967 
 968         {
 969             for (int i = 0; i < productcounter; i++) //refreshes/updates array for user after new product is input into array
 970             {
 971                 ProductDisplayTBL.setValueAt(productArray[i].getModelNumber(), i, 0);
 972                 ProductDisplayTBL.setValueAt(productArray[i].getVolume(), i, 1);
 973                 ProductDisplayTBL.setValueAt(productArray[i].getProductionCost(), i, 2);
 974                 ProductDisplayTBL.setValueAt(productArray[i].getProductionTime(), i, 3);
 975             }
 976             //         name of the table.setValueAt(add what , row,  column);
 977         }
 978     }                                                  
 979 
 980     private void PurchaseOrderIDTextFieldActionPerformed(java.awt.event.ActionEvent evt)                                                         
 981     {                                                             
 982         // TODO add your handling code here:
 983     }                                                        
 984 
 985     private void PurchaseOrderNumberTextFieldActionPerformed(java.awt.event.ActionEvent evt)                                                             
 986     {                                                                 
 987         // TODO add your handling code here:
 988     }                                                            
 989 
 990     private void PurchaseOrderTextFieldActionPerformed(java.awt.event.ActionEvent evt)                                                       
 991     {                                                           
 992         // TODO add your handling code here:
 993     }                                                      
 994 
 995     private void UnitVolumeTextFieldActionPerformed(java.awt.event.ActionEvent evt)                                                    
 996     {                                                        
 997         // TODO add your handling code here:
 998     }                                                   
 999 
1000     private void ModelNumberSortActionPerformed(java.awt.event.ActionEvent evt)                                                
1001     {                                                    
1002         SortandSearchClass S = new SortandSearchClass(); //sorts display table
1003         S.selectionSortOfPurchaseOrderByModelNumber(purchaseOrderArray, ordercounter);
1004         for (int i = 0; i < ordercounter; i++)
1005         {
1006             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getModelNumber(), i, 0);
1007             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getUnits(), i, 1);
1008             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getTotalProductionCost(), i, 2);
1009             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getTotalStorageVolume(), i, 3);
1010             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getPurchaseOrderID(), i, 4);
1011             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getPurchaseOrderNumber(), i, 5);
1012             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getPurchaseOrderReceivedDate(), i, 6);
1013         }        // TODO add your handling code here:
1014     }                                               
1015 
1016     private void OrderRefreshButtonActionPerformed(java.awt.event.ActionEvent evt)                                                   
1017     {                                                       
1018         // TODO add your handling code here:
1019         for (int i = 0; i < ordercounter; i++) //refreshes/updates array for user after new product is input into array
1020         {
1021             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getModelNumber(), i, 0);
1022             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getUnits(), i, 1);
1023             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getTotalProductionCost(), i, 2);
1024             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getTotalStorageVolume(), i, 3);
1025             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getPurchaseOrderID(), i, 4);
1026             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getPurchaseOrderNumber(), i, 5);
1027             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getPurchaseOrderReceivedDate(), i, 6);
1028         }
1029     }                                                  
1030 
1031     private void PurchaseOrderIDSortActionPerformed(java.awt.event.ActionEvent evt)                                                    
1032     {                                                        
1033         SortandSearchClass S = new SortandSearchClass(); //sorts display table
1034         S.selectionSortOfPurchaseOrderByOrderID(purchaseOrderArray, ordercounter);
1035         for (int i = 0; i < ordercounter; i++)
1036         {
1037            OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getModelNumber(), i, 0);
1038             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getUnits(), i, 1);
1039             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getTotalProductionCost(), i, 2);
1040             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getTotalStorageVolume(), i, 3);
1041             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getPurchaseOrderID(), i, 4);
1042             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getPurchaseOrderNumber(), i, 5);
1043             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getPurchaseOrderReceivedDate(), i, 6);
1044         }
1045 // TODO add your handling code here:
1046     }                                                   
1047 
1048     private void PurchaseOrderNumberSortActionPerformed(java.awt.event.ActionEvent evt)                                                        
1049     {                                                            
1050         SortandSearchClass S = new SortandSearchClass(); //sorts display table
1051         S.selectionSortOfPurchaseOrderByOrderNumber(purchaseOrderArray, ordercounter);
1052         for (int i = 0; i < ordercounter; i++)
1053         {
1054             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getModelNumber(), i, 0);
1055             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getUnits(), i, 1);
1056             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getTotalProductionCost(), i, 2);
1057             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getTotalStorageVolume(), i, 3);
1058             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getPurchaseOrderID(), i, 4);
1059             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getPurchaseOrderNumber(), i, 5);
1060             OrderDisplayTBL.setValueAt(purchaseOrderArray[i].getPurchaseOrderReceivedDate(), i, 6);
1061         }
1062 // TODO add your handling code here:
1063     }                                                       
1064 
1065     /**
1066      * @param args the command line arguments
1067      */
1068     public static void main(String args[])
1069     {
1070         /* Set the Nimbus look and feel */
1071         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
1072         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
1073          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
1074          */
1075         try
1076         {
1077             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
1078             {
1079                 if ("Nimbus".equals(info.getName()))
1080                 {
1081                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
1082                     break;
1083                 }
1084             }
1085         } catch (ClassNotFoundException ex)
1086         {
1087             java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
1088         } catch (InstantiationException ex)
1089         {
1090             java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
1091         } catch (IllegalAccessException ex)
1092         {
1093             java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
1094         } catch (javax.swing.UnsupportedLookAndFeelException ex)
1095         {
1096             java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
1097         }
1098         //</editor-fold>
1099 
1100         /* Create and display the form */
1101         java.awt.EventQueue.invokeLater(new Runnable()
1102         {
1103             public void run()
1104             {
1105                 new MainGUI().setVisible(true);
1106             }
1107         });
1108     }
1109 
1110     // Variables declaration - do not modify                     
1111     private javax.swing.JButton AddOrderButton;
1112     private javax.swing.JButton AddProductButton;
1113     private javax.swing.JComboBox<String> DateBox;
1114     private javax.swing.JTextField EditProductionCostField;
1115     private javax.swing.JTextField EditProductionTimeField;
1116     private javax.swing.JButton ModelNumberSort;
1117     private javax.swing.JComboBox<String> MonthBox;
1118     private javax.swing.JTextField NewProductVolumeTextField;
1119     private javax.swing.JTextField OldEstimatedProductionCostTextField;
1120     private javax.swing.JTextField OldEstimatedProductionTimeTextField;
1121     private javax.swing.JTextField OldProductVolumeTextField;
1122     private javax.swing.JTable OrderDisplayTBL;
1123     private javax.swing.JButton OrderRefreshButton;
1124     private javax.swing.JTable ProductDisplayTBL;
1125     private javax.swing.JLabel ProductModelLabel;
1126     private javax.swing.JTextField ProductModelTextField;
1127     private javax.swing.JButton ProductRefreshButton;
1128     private javax.swing.JButton ProductSortButton;
1129     private javax.swing.JTextField ProductionCostTextField;
1130     private javax.swing.JTextField ProductionTimeTextField;
1131     private javax.swing.JButton PurchaseOrderIDSort;
1132     private javax.swing.JTextField PurchaseOrderIDTextField;
1133     private javax.swing.JButton PurchaseOrderNumberSort;
1134     private javax.swing.JTextField PurchaseOrderNumberTextField;
1135     private javax.swing.JTextField PurchaseOrderTextField;
1136     private javax.swing.JButton SearchButton;
1137     private javax.swing.JTextField SearchProductModelField;
1138     private javax.swing.JButton SetNewProductData;
1139     private javax.swing.JTextField StorageVolumeTextField;
1140     private javax.swing.JTextField UnitVolumeTextField;
1141     private javax.swing.JComboBox<String> YearBox;
1142     private javax.swing.JLabel jLabel10;
1143     private javax.swing.JLabel jLabel11;
1144     private javax.swing.JLabel jLabel12;
1145     private javax.swing.JLabel jLabel13;
1146     private javax.swing.JLabel jLabel14;
1147     private javax.swing.JLabel jLabel15;
1148     private javax.swing.JLabel jLabel16;
1149     private javax.swing.JLabel jLabel17;
1150     private javax.swing.JLabel jLabel18;
1151     private javax.swing.JLabel jLabel19;
1152     private javax.swing.JLabel jLabel2;
1153     private javax.swing.JLabel jLabel20;
1154     private javax.swing.JLabel jLabel21;
1155     private javax.swing.JLabel jLabel23;
1156     private javax.swing.JLabel jLabel24;
1157     private javax.swing.JLabel jLabel25;
1158     private javax.swing.JLabel jLabel3;
1159     private javax.swing.JLabel jLabel4;
1160     private javax.swing.JLabel jLabel6;
1161     private javax.swing.JLabel jLabel7;
1162     private javax.swing.JLabel jLabel8;
1163     private javax.swing.JLabel jLabel9;
1164     private javax.swing.JPanel jPanel1;
1165     private javax.swing.JPanel jPanel2;
1166     private javax.swing.JScrollPane jScrollPane1;
1167     private javax.swing.JScrollPane jScrollPane2;
1168     private javax.swing.JTabbedPane jTabbedPane1;
1169     // End of variables declaration                   
1170 }
1171