/Users/johnr/Desktop/IA pdf Downloads/_New Projects Downloads May 7th/AustinsClosetMySQL_Emma/src/AustinsClosetMySQL/AustinsClosetMySQL.java
   1 /*
   2  * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
   3  * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
   4  */
   5 package AustinsClosetMySQL;
   6 
   7 import javax.swing.JFrame;
   8 import javax.swing.JOptionPane;
   9 import java.sql.Connection;
  10 import java.sql.DriverManager;
  11 import java.sql.PreparedStatement;
  12 import java.sql.ResultSet;
  13 import java.sql.ResultSetMetaData;
  14 import java.sql.SQLException;
  15 import javax.swing.JTable;
  16 import javax.swing.table.DefaultTableModel;
  17 import java.text.DateFormat;
  18 import java.text.MessageFormat;
  19 import java.text.SimpleDateFormat;
  20 import java.util.Vector; 
  21 import java.util.ArrayList;
  22 import java.sql.Statement;
  23 
  24 
  25 
  26 /**
  27  *
  28  * @author 21156
  29  */
  30 public class AustinsClosetMySQL extends javax.swing.JFrame {
  31 
  32     private static final String username = "root";
  33     private static final String password = "M@n@t33123";
  34     private static final String dataConn = "jdbc:mySQL://localhost:3306/austinsIA_mySQL";
  35     
  36     Connection sqlConn = null;
  37     PreparedStatement pst = null;
  38     ResultSet rs = null;
  39     int q, i, id, deleteItem, saveOutfit;
  40     
  41     public AustinsClosetMySQL() {
  42         initComponents();
  43     }
  44 
  45     /**
  46      * This method is called from within the constructor to initialize the form.
  47      * WARNING: Do NOT modify this code. The content of this method is always
  48      * regenerated by the Form Editor.
  49      */
  50     
  51     //=====================Function==========================
  52     public class outfitOutput_table extends javax.swing.JFrame{
  53         
  54         public outfitOutput_table(){
  55             initComponents();
  56             showShirts();
  57         } 
  58         
  59     }
  60 
  61     
  62     public Connection getConnection()
  63             //getting mySQL connection
  64     {
  65         Connection con = null;
  66         
  67         try{
  68             con = DriverManager.getConnection("jdbc:mySQL://localhost:3306/austinsIA_mySQL", "root", "M@n@t33123");
  69             
  70         }catch(Exception ex){
  71             System.out.println(ex.getMessage());
  72         }
  73         
  74         return con;
  75     }
  76     
  77     public ArrayList<SearchCloset> AustinSearch()
  78             //to select a shirt
  79             //search closet is its own class
  80     {
  81         ArrayList<SearchCloset> searchAustins = new ArrayList<SearchCloset>();
  82         
  83         Statement st;
  84         ResultSet rs;
  85         
  86         
  87     
  88         boolean shirt = false;
  89         boolean pants = false;
  90         boolean shorts = false;
  91         boolean coats = false;
  92         boolean accessory = false;
  93         //have to set booleans to go through the if statements
  94     
  95         String material = "";
  96         String shirtColor = "";
  97         String pantsColor = "";
  98         String shortsColor = "";
  99         String coatsColor = "";
 100         String accessoryColor = "";
 101         //have to set strings to be able to search in the DB
 102         
 103         var temp = tempDDwn.getSelectedItem().toString();
 104         var weather = weatherDDwn.getSelectedItem().toString();
 105         var occassion = occassionDDwn.getSelectedItem().toString();
 106         var actLevel = actLevelDDwn.getSelectedItem().toString();
 107         
 108         
 109          if(temp == "55-65" || temp == "45-55" || temp == "32-45" || temp == "<32"){
 110         shorts = true;
 111     }
 112     if(temp == "65-75" || temp == "75-85" || temp == "85-95" || temp == ">95"){
 113         pants = true;
 114         coats = true;
 115     }
 116     
 117 
 118         if(shirt == false){
 119             
 120             if(temp == "32-45" || temp == "<32"){
 121                 material = "Thick";
 122             }
 123             if(temp == "55-65" || temp == "45-55"){
 124                 material = "Medium";
 125             }
 126             if(temp == "65-75" || temp == "75-85"){
 127                 material = "Thin";
 128             }
 129             if(temp == "85-95" || temp == ">95"){
 130                 material = "Dri-fit";
 131             }
 132             if(actLevel == "High"){
 133                 material = "Dri-fit";
 134             }
 135             
 136             
 137             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 138             //using math random to pick a color for the shirt
 139             
 140             if(colorChoice == 1){
 141                 shirtColor = "Red";
 142             }
 143             if(colorChoice == 2){
 144                 shirtColor = "Orange";
 145             }
 146             if(colorChoice == 3){
 147                 shirtColor = "Yellow";
 148             }
 149             if(colorChoice == 4){
 150                 shirtColor = "Green";
 151             }
 152             if(colorChoice == 5){
 153                 shirtColor = "Blue";
 154             }
 155             if(colorChoice == 6){
 156                 shirtColor = "Purple";
 157             }
 158             if(colorChoice == 7){
 159                 shirtColor = "Black";
 160             }
 161             if(colorChoice == 8){
 162                 shirtColor = "White";
 163             }
 164             if(colorChoice == 9){
 165                 shirtColor = "Brown";
 166             }
 167             if(colorChoice == 10){
 168                 shirtColor = "Grey";
 169             }
 170             if(colorChoice == 11){
 171                 shirtColor = "Silver";
 172             }
 173             if(colorChoice == 12){
 174                 shirtColor = "Gold";
 175             }
 176             if(colorChoice == 13){
 177                 shirtColor = "Multicolor";
 178             }
 179             
 180             if(occassion == "Beach"){
 181                 material = "Thin";
 182             } 
 183         }   
 184         if(shorts == false){
 185             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 186             
 187             if(colorChoice == 1){
 188                 shortsColor = "Red";
 189             }
 190             if(colorChoice == 2){
 191                 shortsColor = "Orange";
 192             }
 193             if(colorChoice == 3){
 194                 shortsColor = "Yellow";
 195             }
 196             if(colorChoice == 4){
 197                 shortsColor = "Green";
 198             }
 199             if(colorChoice == 5){
 200                 shortsColor = "Blue";
 201             }
 202             if(colorChoice == 6){
 203                 shortsColor = "Purple";
 204             }
 205             if(colorChoice == 7){
 206                 shortsColor = "Black";
 207             }
 208             if(colorChoice == 8){
 209                 shortsColor = "White";
 210             }
 211             if(colorChoice == 9){
 212                 shortsColor = "Brown";
 213             }
 214             if(colorChoice == 10){
 215                 shortsColor = "Grey";
 216             }
 217             if(colorChoice == 11){
 218                 shortsColor = "Silver";
 219             }
 220             if(colorChoice == 12){
 221                 shortsColor = "Gold";
 222             }
 223             if(colorChoice == 13){
 224                 shortsColor = "Multicolor";
 225             }
 226         }
 227         if(pants == false){
 228             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 229             
 230             if(colorChoice == 1){
 231                 pantsColor = "Red";
 232             }
 233             if(colorChoice == 2){
 234                 pantsColor = "Orange";
 235             }
 236             if(colorChoice == 3){
 237                 pantsColor = "Yellow";
 238             }
 239             if(colorChoice == 4){
 240                 pantsColor = "Green";
 241             }
 242             if(colorChoice == 5){
 243                 pantsColor = "Blue";
 244             }
 245             if(colorChoice == 6){
 246                 pantsColor = "Purple";
 247             }
 248             if(colorChoice == 7){
 249                 pantsColor = "Black";
 250             }
 251             if(colorChoice == 8){
 252                 pantsColor = "White";
 253             }
 254             if(colorChoice == 9){
 255                 pantsColor = "Brown";
 256             }
 257             if(colorChoice == 10){
 258                 pantsColor = "Grey";
 259             }
 260             if(colorChoice == 11){
 261                 pantsColor = "Silver";
 262             }
 263             if(colorChoice == 12){
 264                 pantsColor = "Gold";
 265             }
 266             if(colorChoice == 13){
 267                 pantsColor = "Multicolor";
 268             }
 269         }
 270         if(coats == false){
 271             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 272             
 273             if(colorChoice == 1){
 274                 coatsColor = "Red";
 275             }
 276             if(colorChoice == 2){
 277                 coatsColor = "Orange";
 278             }
 279             if(colorChoice == 3){
 280                 coatsColor = "Yellow";
 281             }
 282             if(colorChoice == 4){
 283                 coatsColor = "Green";
 284             }
 285             if(colorChoice == 5){
 286                 coatsColor = "Blue";
 287             }
 288             if(colorChoice == 6){
 289                 coatsColor = "Purple";
 290             }
 291             if(colorChoice == 7){
 292                 coatsColor = "Black";
 293             }
 294             if(colorChoice == 8){
 295                 coatsColor = "White";
 296             }
 297             if(colorChoice == 9){
 298                 coatsColor = "Brown";
 299             }
 300             if(colorChoice == 10){
 301                 coatsColor = "Grey";
 302             }
 303             if(colorChoice == 11){
 304                 coatsColor = "Silver";
 305             }
 306             if(colorChoice == 12){
 307                 coatsColor = "Gold";
 308             }
 309             if(colorChoice == 13){
 310                 coatsColor = "Multicolor";
 311             }
 312         }
 313         if(occassion == "Beach" || occassion == "Workout" || occassion == "Villanova Game" || occassion == "Party"){
 314             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 315             accessory = true;
 316             if(colorChoice == 1){
 317                 accessoryColor = "Red";
 318             }
 319             if(colorChoice == 2){
 320                 accessoryColor = "Orange";
 321             }
 322             if(colorChoice == 3){
 323                 accessoryColor = "Yellow";
 324             }
 325             if(colorChoice == 4){
 326                 accessoryColor = "Green";
 327             }
 328             if(colorChoice == 5){
 329                 accessoryColor = "Blue";
 330             }
 331             if(colorChoice == 6){
 332                 accessoryColor = "Purple";
 333             }
 334             if(colorChoice == 7){
 335                 accessoryColor = "Black";
 336             }
 337             if(colorChoice == 8){
 338                 accessoryColor = "White";
 339             }
 340             if(colorChoice == 9){
 341                 accessoryColor = "Brown";
 342             }
 343             if(colorChoice == 10){
 344                 accessoryColor = "Grey";
 345             }
 346             if(colorChoice == 11){
 347                 accessoryColor = "Silver";
 348             }
 349             if(colorChoice == 12){
 350                 accessoryColor = "Gold";
 351             }
 352             if(colorChoice == 13){
 353                 accessoryColor = "Multicolor";
 354             }
 355         }
 356         
 357         
 358             try{
 359             Class.forName("com.mysql.cj.jdbc.Driver");
 360             sqlConn = DriverManager.getConnection(dataConn, username, password);                    
 361             Connection con = getConnection();
 362             String query1 = "SELECT * FROM whole_closet WHERE Type = 'Shirt' AND Material = '" + material + "' AND Color = '" + shirtColor + "' AND Formality = '" + occassion + "' ORDER BY RAND() LIMIT 2"; 
 363             //goes to DB to find things that fit the criteria from my client, twice (limit 2)
 364             st = con.createStatement();
 365             rs = st.executeQuery(query1);
 366             SearchCloset searchCloset;
 367         
 368             while(rs.next())
 369             {
 370                 searchCloset = new SearchCloset(
 371                         rs.getInt("ID"),
 372                         rs.getString("Name"),
 373                         rs.getString("Type"),
 374                         rs.getString("Color"),
 375                         rs.getString("Pattern"),
 376                         rs.getString("Material"),
 377                         rs.getString("Formality"),
 378                         rs.getString("Activity")
 379                         );
 380                 searchAustins.add(searchCloset); 
 381                 
 382                 
 383             }//while
 384             
 385         }
 386             
 387         
 388             
 389         catch(Exception ex){
 390             JOptionPane.showMessageDialog(null, ex);
 391         }
 392             
 393         return searchAustins; 
 394     } 
 395     
 396 
 397     public void showShirts(){
 398         //this is for the actual outputting of the shirt
 399         ArrayList<SearchCloset> list = AustinSearch();
 400         DefaultTableModel model = (DefaultTableModel)OutfitOutput_Table.getModel();
 401         //gets the table model and inputs from mySQL to the columns of NetBeans
 402         Object[] row = new Object[3];
 403         for(int i = 0; i <list.size(); i++){
 404             row[0] = list.get(i).getName();
 405             row[1] = list.get(i).getType();
 406             
 407             model.addRow(row);
 408         }
 409     }
 410 
 411     public ArrayList<SearchCloset> shortSearch()
 412     {
 413         ArrayList<SearchCloset> searchShorts = new ArrayList<SearchCloset>();
 414         
 415         Statement st;
 416         ResultSet rs;
 417         
 418         
 419     
 420         boolean shirt = false;
 421         boolean pants = false;
 422         boolean shorts = false;
 423         boolean coats = false;
 424         boolean accessory = false;
 425     
 426         String material = "";
 427         String shirtColor = "";
 428         String pantsColor = "";
 429         String shortsColor = "";
 430         String coatsColor = "";
 431         String accessoryColor = "";
 432         
 433         var temp = tempDDwn.getSelectedItem().toString();
 434         var weather = weatherDDwn.getSelectedItem().toString();
 435         var occassion = occassionDDwn.getSelectedItem().toString();
 436         var actLevel = actLevelDDwn.getSelectedItem().toString();
 437         
 438         
 439          if(temp == "55-65" || temp == "45-55" || temp == "32-45" || temp == "<32"){
 440         shorts = true;
 441     }
 442     if(temp == "65-75" || temp == "75-85" || temp == "85-95" || temp == ">95"){
 443         pants = true;
 444         coats = true;
 445     }
 446     
 447 
 448         if(shirt == false){
 449             
 450             if(temp == "32-45" || temp == "<32"){
 451                 material = "Thick";
 452             }
 453             if(temp == "55-65" || temp == "45-55"){
 454                 material = "Medium";
 455             }
 456             if(temp == "65-75" || temp == "75-85"){
 457                 material = "Thin";
 458             }
 459             if(temp == "85-95" || temp == ">95"){
 460                 material = "Dri-fit";
 461             }
 462             if(actLevel == "High"){
 463                 material = "Dri-fit";
 464             }
 465             
 466             
 467             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 468             
 469             if(colorChoice == 1){
 470                 shirtColor = "Red";
 471             }
 472             if(colorChoice == 2){
 473                 shirtColor = "Orange";
 474             }
 475             if(colorChoice == 3){
 476                 shirtColor = "Yellow";
 477             }
 478             if(colorChoice == 4){
 479                 shirtColor = "Green";
 480             }
 481             if(colorChoice == 5){
 482                 shirtColor = "Blue";
 483             }
 484             if(colorChoice == 6){
 485                 shirtColor = "Purple";
 486             }
 487             if(colorChoice == 7){
 488                 shirtColor = "Black";
 489             }
 490             if(colorChoice == 8){
 491                 shirtColor = "White";
 492             }
 493             if(colorChoice == 9){
 494                 shirtColor = "Brown";
 495             }
 496             if(colorChoice == 10){
 497                 shirtColor = "Grey";
 498             }
 499             if(colorChoice == 11){
 500                 shirtColor = "Silver";
 501             }
 502             if(colorChoice == 12){
 503                 shirtColor = "Gold";
 504             }
 505             if(colorChoice == 13){
 506                 shirtColor = "Multicolor";
 507             }
 508             
 509             if(occassion == "Beach"){
 510                 material = "Thin";
 511             } 
 512         }   
 513         if(shorts == false){
 514             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 515             
 516             if(colorChoice == 1){
 517                 shortsColor = "Red";
 518             }
 519             if(colorChoice == 2){
 520                 shortsColor = "Orange";
 521             }
 522             if(colorChoice == 3){
 523                 shortsColor = "Yellow";
 524             }
 525             if(colorChoice == 4){
 526                 shortsColor = "Green";
 527             }
 528             if(colorChoice == 5){
 529                 shortsColor = "Blue";
 530             }
 531             if(colorChoice == 6){
 532                 shortsColor = "Purple";
 533             }
 534             if(colorChoice == 7){
 535                 shortsColor = "Black";
 536             }
 537             if(colorChoice == 8){
 538                 shortsColor = "White";
 539             }
 540             if(colorChoice == 9){
 541                 shortsColor = "Brown";
 542             }
 543             if(colorChoice == 10){
 544                 shortsColor = "Grey";
 545             }
 546             if(colorChoice == 11){
 547                 shortsColor = "Silver";
 548             }
 549             if(colorChoice == 12){
 550                 shortsColor = "Gold";
 551             }
 552             if(colorChoice == 13){
 553                 shortsColor = "Multicolor";
 554             }
 555         }
 556         if(pants == false){
 557             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 558             
 559             if(colorChoice == 1){
 560                 pantsColor = "Red";
 561             }
 562             if(colorChoice == 2){
 563                 pantsColor = "Orange";
 564             }
 565             if(colorChoice == 3){
 566                 pantsColor = "Yellow";
 567             }
 568             if(colorChoice == 4){
 569                 pantsColor = "Green";
 570             }
 571             if(colorChoice == 5){
 572                 pantsColor = "Blue";
 573             }
 574             if(colorChoice == 6){
 575                 pantsColor = "Purple";
 576             }
 577             if(colorChoice == 7){
 578                 pantsColor = "Black";
 579             }
 580             if(colorChoice == 8){
 581                 pantsColor = "White";
 582             }
 583             if(colorChoice == 9){
 584                 pantsColor = "Brown";
 585             }
 586             if(colorChoice == 10){
 587                 pantsColor = "Grey";
 588             }
 589             if(colorChoice == 11){
 590                 pantsColor = "Silver";
 591             }
 592             if(colorChoice == 12){
 593                 pantsColor = "Gold";
 594             }
 595             if(colorChoice == 13){
 596                 pantsColor = "Multicolor";
 597             }
 598         }
 599         if(coats == false){
 600             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 601             
 602             if(colorChoice == 1){
 603                 coatsColor = "Red";
 604             }
 605             if(colorChoice == 2){
 606                 coatsColor = "Orange";
 607             }
 608             if(colorChoice == 3){
 609                 coatsColor = "Yellow";
 610             }
 611             if(colorChoice == 4){
 612                 coatsColor = "Green";
 613             }
 614             if(colorChoice == 5){
 615                 coatsColor = "Blue";
 616             }
 617             if(colorChoice == 6){
 618                 coatsColor = "Purple";
 619             }
 620             if(colorChoice == 7){
 621                 coatsColor = "Black";
 622             }
 623             if(colorChoice == 8){
 624                 coatsColor = "White";
 625             }
 626             if(colorChoice == 9){
 627                 coatsColor = "Brown";
 628             }
 629             if(colorChoice == 10){
 630                 coatsColor = "Grey";
 631             }
 632             if(colorChoice == 11){
 633                 coatsColor = "Silver";
 634             }
 635             if(colorChoice == 12){
 636                 coatsColor = "Gold";
 637             }
 638             if(colorChoice == 13){
 639                 coatsColor = "Multicolor";
 640             }
 641         }
 642         if(occassion == "Beach" || occassion == "Workout" || occassion == "Villanova Game" || occassion == "Party"){
 643             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 644             accessory = true;
 645             if(colorChoice == 1){
 646                 accessoryColor = "Red";
 647             }
 648             if(colorChoice == 2){
 649                 accessoryColor = "Orange";
 650             }
 651             if(colorChoice == 3){
 652                 accessoryColor = "Yellow";
 653             }
 654             if(colorChoice == 4){
 655                 accessoryColor = "Green";
 656             }
 657             if(colorChoice == 5){
 658                 accessoryColor = "Blue";
 659             }
 660             if(colorChoice == 6){
 661                 accessoryColor = "Purple";
 662             }
 663             if(colorChoice == 7){
 664                 accessoryColor = "Black";
 665             }
 666             if(colorChoice == 8){
 667                 accessoryColor = "White";
 668             }
 669             if(colorChoice == 9){
 670                 accessoryColor = "Brown";
 671             }
 672             if(colorChoice == 10){
 673                 accessoryColor = "Grey";
 674             }
 675             if(colorChoice == 11){
 676                 accessoryColor = "Silver";
 677             }
 678             if(colorChoice == 12){
 679                 accessoryColor = "Gold";
 680             }
 681             if(colorChoice == 13){
 682                 accessoryColor = "Multicolor";
 683             }
 684         }
 685         
 686         
 687             try{
 688             Class.forName("com.mysql.cj.jdbc.Driver");
 689             sqlConn = DriverManager.getConnection(dataConn, username, password);                    
 690             Connection con = getConnection();
 691             String query1 = "SELECT * FROM whole_closet WHERE Type = 'Shorts' AND Material = '" + material + "' AND Color = '" + shortsColor + "' AND Formality = '" + occassion + "' ORDER BY RAND() LIMIT 2"; 
 692             st = con.createStatement();
 693             rs = st.executeQuery(query1);
 694             SearchCloset searchCloset;
 695         
 696             while(rs.next())
 697             {
 698                 searchCloset = new SearchCloset(
 699                         rs.getInt("ID"),
 700                         rs.getString("Name"),
 701                         rs.getString("Type"),
 702                         rs.getString("Color"),
 703                         rs.getString("Pattern"),
 704                         rs.getString("Material"),
 705                         rs.getString("Formality"),
 706                         rs.getString("Activity")
 707                         );
 708                 searchShorts.add(searchCloset); 
 709                 
 710                 
 711             }//while
 712             
 713         }
 714             
 715         
 716             
 717         catch(Exception ex){
 718             JOptionPane.showMessageDialog(null, ex);
 719         }
 720             
 721         return searchShorts; 
 722     } 
 723     
 724 
 725     public void showShorts(){
 726         ArrayList<SearchCloset> list = shortSearch();
 727         DefaultTableModel model = (DefaultTableModel)OutfitOutput_Table.getModel();
 728         Object[] row = new Object[3];
 729         for(int i = 0; i <list.size(); i++){
 730             row[0] = list.get(i).getName();
 731             row[1] = list.get(i).getType();
 732             
 733             model.addRow(row);
 734         }
 735     }    
 736         
 737     public ArrayList<SearchCloset> pantsSearch()
 738     {
 739         ArrayList<SearchCloset> searchPants = new ArrayList<SearchCloset>();
 740         
 741         Statement st;
 742         ResultSet rs;
 743         
 744         
 745     
 746         boolean shirt = false;
 747         boolean pants = false;
 748         boolean shorts = false;
 749         boolean coats = false;
 750         boolean accessory = false;
 751     
 752         String material = "";
 753         String shirtColor = "";
 754         String pantsColor = "";
 755         String shortsColor = "";
 756         String coatsColor = "";
 757         String accessoryColor = "";
 758         
 759         var temp = tempDDwn.getSelectedItem().toString();
 760         var weather = weatherDDwn.getSelectedItem().toString();
 761         var occassion = occassionDDwn.getSelectedItem().toString();
 762         var actLevel = actLevelDDwn.getSelectedItem().toString();
 763         
 764         
 765          if(temp == "55-65" || temp == "45-55" || temp == "32-45" || temp == "<32"){
 766         shorts = true;
 767     }
 768     if(temp == "65-75" || temp == "75-85" || temp == "85-95" || temp == ">95"){
 769         pants = true;
 770         coats = true;
 771     }
 772     
 773 
 774         if(shirt == false){
 775             
 776             if(temp == "32-45" || temp == "<32"){
 777                 material = "Thick";
 778             }
 779             if(temp == "55-65" || temp == "45-55"){
 780                 material = "Medium";
 781             }
 782             if(temp == "65-75" || temp == "75-85"){
 783                 material = "Thin";
 784             }
 785             if(temp == "85-95" || temp == ">95"){
 786                 material = "Dri-fit";
 787             }
 788             if(actLevel == "High"){
 789                 material = "Dri-fit";
 790             }
 791             
 792             
 793             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 794             
 795             if(colorChoice == 1){
 796                 shirtColor = "Red";
 797             }
 798             if(colorChoice == 2){
 799                 shirtColor = "Orange";
 800             }
 801             if(colorChoice == 3){
 802                 shirtColor = "Yellow";
 803             }
 804             if(colorChoice == 4){
 805                 shirtColor = "Green";
 806             }
 807             if(colorChoice == 5){
 808                 shirtColor = "Blue";
 809             }
 810             if(colorChoice == 6){
 811                 shirtColor = "Purple";
 812             }
 813             if(colorChoice == 7){
 814                 shirtColor = "Black";
 815             }
 816             if(colorChoice == 8){
 817                 shirtColor = "White";
 818             }
 819             if(colorChoice == 9){
 820                 shirtColor = "Brown";
 821             }
 822             if(colorChoice == 10){
 823                 shirtColor = "Grey";
 824             }
 825             if(colorChoice == 11){
 826                 shirtColor = "Silver";
 827             }
 828             if(colorChoice == 12){
 829                 shirtColor = "Gold";
 830             }
 831             if(colorChoice == 13){
 832                 shirtColor = "Multicolor";
 833             }
 834             
 835             if(occassion == "Beach"){
 836                 material = "Thin";
 837             } 
 838         }   
 839         if(shorts == false){
 840             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 841             
 842             if(colorChoice == 1){
 843                 shortsColor = "Red";
 844             }
 845             if(colorChoice == 2){
 846                 shortsColor = "Orange";
 847             }
 848             if(colorChoice == 3){
 849                 shortsColor = "Yellow";
 850             }
 851             if(colorChoice == 4){
 852                 shortsColor = "Green";
 853             }
 854             if(colorChoice == 5){
 855                 shortsColor = "Blue";
 856             }
 857             if(colorChoice == 6){
 858                 shortsColor = "Purple";
 859             }
 860             if(colorChoice == 7){
 861                 shortsColor = "Black";
 862             }
 863             if(colorChoice == 8){
 864                 shortsColor = "White";
 865             }
 866             if(colorChoice == 9){
 867                 shortsColor = "Brown";
 868             }
 869             if(colorChoice == 10){
 870                 shortsColor = "Grey";
 871             }
 872             if(colorChoice == 11){
 873                 shortsColor = "Silver";
 874             }
 875             if(colorChoice == 12){
 876                 shortsColor = "Gold";
 877             }
 878             if(colorChoice == 13){
 879                 shortsColor = "Multicolor";
 880             }
 881         }
 882         if(pants == false){
 883             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 884             
 885             if(colorChoice == 1){
 886                 pantsColor = "Red";
 887             }
 888             if(colorChoice == 2){
 889                 pantsColor = "Orange";
 890             }
 891             if(colorChoice == 3){
 892                 pantsColor = "Yellow";
 893             }
 894             if(colorChoice == 4){
 895                 pantsColor = "Green";
 896             }
 897             if(colorChoice == 5){
 898                 pantsColor = "Blue";
 899             }
 900             if(colorChoice == 6){
 901                 pantsColor = "Purple";
 902             }
 903             if(colorChoice == 7){
 904                 pantsColor = "Black";
 905             }
 906             if(colorChoice == 8){
 907                 pantsColor = "White";
 908             }
 909             if(colorChoice == 9){
 910                 pantsColor = "Brown";
 911             }
 912             if(colorChoice == 10){
 913                 pantsColor = "Grey";
 914             }
 915             if(colorChoice == 11){
 916                 pantsColor = "Silver";
 917             }
 918             if(colorChoice == 12){
 919                 pantsColor = "Gold";
 920             }
 921             if(colorChoice == 13){
 922                 pantsColor = "Multicolor";
 923             }
 924         }
 925         if(coats == false){
 926             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 927             
 928             if(colorChoice == 1){
 929                 coatsColor = "Red";
 930             }
 931             if(colorChoice == 2){
 932                 coatsColor = "Orange";
 933             }
 934             if(colorChoice == 3){
 935                 coatsColor = "Yellow";
 936             }
 937             if(colorChoice == 4){
 938                 coatsColor = "Green";
 939             }
 940             if(colorChoice == 5){
 941                 coatsColor = "Blue";
 942             }
 943             if(colorChoice == 6){
 944                 coatsColor = "Purple";
 945             }
 946             if(colorChoice == 7){
 947                 coatsColor = "Black";
 948             }
 949             if(colorChoice == 8){
 950                 coatsColor = "White";
 951             }
 952             if(colorChoice == 9){
 953                 coatsColor = "Brown";
 954             }
 955             if(colorChoice == 10){
 956                 coatsColor = "Grey";
 957             }
 958             if(colorChoice == 11){
 959                 coatsColor = "Silver";
 960             }
 961             if(colorChoice == 12){
 962                 coatsColor = "Gold";
 963             }
 964             if(colorChoice == 13){
 965                 coatsColor = "Multicolor";
 966             }
 967         }
 968         if(occassion == "Beach" || occassion == "Workout" || occassion == "Villanova Game" || occassion == "Party"){
 969             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
 970             accessory = true;
 971             if(colorChoice == 1){
 972                 accessoryColor = "Red";
 973             }
 974             if(colorChoice == 2){
 975                 accessoryColor = "Orange";
 976             }
 977             if(colorChoice == 3){
 978                 accessoryColor = "Yellow";
 979             }
 980             if(colorChoice == 4){
 981                 accessoryColor = "Green";
 982             }
 983             if(colorChoice == 5){
 984                 accessoryColor = "Blue";
 985             }
 986             if(colorChoice == 6){
 987                 accessoryColor = "Purple";
 988             }
 989             if(colorChoice == 7){
 990                 accessoryColor = "Black";
 991             }
 992             if(colorChoice == 8){
 993                 accessoryColor = "White";
 994             }
 995             if(colorChoice == 9){
 996                 accessoryColor = "Brown";
 997             }
 998             if(colorChoice == 10){
 999                 accessoryColor = "Grey";
1000             }
1001             if(colorChoice == 11){
1002                 accessoryColor = "Silver";
1003             }
1004             if(colorChoice == 12){
1005                 accessoryColor = "Gold";
1006             }
1007             if(colorChoice == 13){
1008                 accessoryColor = "Multicolor";
1009             }
1010         }
1011         
1012         
1013             try{
1014             Class.forName("com.mysql.cj.jdbc.Driver");
1015             sqlConn = DriverManager.getConnection(dataConn, username, password);                    
1016             Connection con = getConnection();
1017             String query1 = "SELECT * FROM whole_closet WHERE Type = 'Pants' AND Material = '" + material + "' AND Color = '" + pantsColor + "' AND Formality = '" + occassion + "' ORDER BY RAND() LIMIT 2"; 
1018             st = con.createStatement();
1019             rs = st.executeQuery(query1);
1020             SearchCloset searchCloset;
1021         
1022             while(rs.next())
1023             {
1024                 searchCloset = new SearchCloset(
1025                         rs.getInt("ID"),
1026                         rs.getString("Name"),
1027                         rs.getString("Type"),
1028                         rs.getString("Color"),
1029                         rs.getString("Pattern"),
1030                         rs.getString("Material"),
1031                         rs.getString("Formality"),
1032                         rs.getString("Activity")
1033                         );
1034                 searchPants.add(searchCloset); 
1035                 
1036                 
1037             }//while
1038             
1039         }
1040             
1041         
1042             
1043         catch(Exception ex){
1044             JOptionPane.showMessageDialog(null, ex);
1045         }
1046             
1047         return searchPants; 
1048     } 
1049     
1050 
1051     public void showPants(){
1052         ArrayList<SearchCloset> list = pantsSearch();
1053         DefaultTableModel model = (DefaultTableModel)OutfitOutput_Table.getModel();
1054         Object[] row = new Object[3];
1055         for(int i = 0; i <list.size(); i++){
1056             row[0] = list.get(i).getName();
1057             row[1] = list.get(i).getType();
1058             
1059             model.addRow(row);
1060         }
1061     }    
1062     
1063     public ArrayList<SearchCloset> coatSearch()
1064     {
1065         ArrayList<SearchCloset> searchCoats = new ArrayList<SearchCloset>();
1066         
1067         Statement st;
1068         ResultSet rs;
1069         
1070         
1071     
1072         boolean shirt = false;
1073         boolean pants = false;
1074         boolean shorts = false;
1075         boolean coats = false;
1076         boolean accessory = false;
1077     
1078         String material = "";
1079         String shirtColor = "";
1080         String pantsColor = "";
1081         String shortsColor = "";
1082         String coatsColor = "";
1083         String accessoryColor = "";
1084         
1085         var temp = tempDDwn.getSelectedItem().toString();
1086         var weather = weatherDDwn.getSelectedItem().toString();
1087         var occassion = occassionDDwn.getSelectedItem().toString();
1088         var actLevel = actLevelDDwn.getSelectedItem().toString();
1089         
1090         
1091          if(temp == "55-65" || temp == "45-55" || temp == "32-45" || temp == "<32"){
1092         shorts = true;
1093     }
1094     if(temp == "65-75" || temp == "75-85" || temp == "85-95" || temp == ">95"){
1095         pants = true;
1096         coats = true;
1097     }
1098     
1099 
1100         if(shirt == false){
1101             
1102             if(temp == "32-45" || temp == "<32"){
1103                 material = "Thick";
1104             }
1105             if(temp == "55-65" || temp == "45-55"){
1106                 material = "Medium";
1107             }
1108             if(temp == "65-75" || temp == "75-85"){
1109                 material = "Thin";
1110             }
1111             if(temp == "85-95" || temp == ">95"){
1112                 material = "Dri-fit";
1113             }
1114             if(actLevel == "High"){
1115                 material = "Dri-fit";
1116             }
1117             
1118             
1119             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
1120             
1121             if(colorChoice == 1){
1122                 shirtColor = "Red";
1123             }
1124             if(colorChoice == 2){
1125                 shirtColor = "Orange";
1126             }
1127             if(colorChoice == 3){
1128                 shirtColor = "Yellow";
1129             }
1130             if(colorChoice == 4){
1131                 shirtColor = "Green";
1132             }
1133             if(colorChoice == 5){
1134                 shirtColor = "Blue";
1135             }
1136             if(colorChoice == 6){
1137                 shirtColor = "Purple";
1138             }
1139             if(colorChoice == 7){
1140                 shirtColor = "Black";
1141             }
1142             if(colorChoice == 8){
1143                 shirtColor = "White";
1144             }
1145             if(colorChoice == 9){
1146                 shirtColor = "Brown";
1147             }
1148             if(colorChoice == 10){
1149                 shirtColor = "Grey";
1150             }
1151             if(colorChoice == 11){
1152                 shirtColor = "Silver";
1153             }
1154             if(colorChoice == 12){
1155                 shirtColor = "Gold";
1156             }
1157             if(colorChoice == 13){
1158                 shirtColor = "Multicolor";
1159             }
1160             
1161             if(occassion == "Beach"){
1162                 material = "Thin";
1163             } 
1164         }   
1165         if(shorts == false){
1166             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
1167             
1168             if(colorChoice == 1){
1169                 shortsColor = "Red";
1170             }
1171             if(colorChoice == 2){
1172                 shortsColor = "Orange";
1173             }
1174             if(colorChoice == 3){
1175                 shortsColor = "Yellow";
1176             }
1177             if(colorChoice == 4){
1178                 shortsColor = "Green";
1179             }
1180             if(colorChoice == 5){
1181                 shortsColor = "Blue";
1182             }
1183             if(colorChoice == 6){
1184                 shortsColor = "Purple";
1185             }
1186             if(colorChoice == 7){
1187                 shortsColor = "Black";
1188             }
1189             if(colorChoice == 8){
1190                 shortsColor = "White";
1191             }
1192             if(colorChoice == 9){
1193                 shortsColor = "Brown";
1194             }
1195             if(colorChoice == 10){
1196                 shortsColor = "Grey";
1197             }
1198             if(colorChoice == 11){
1199                 shortsColor = "Silver";
1200             }
1201             if(colorChoice == 12){
1202                 shortsColor = "Gold";
1203             }
1204             if(colorChoice == 13){
1205                 shortsColor = "Multicolor";
1206             }
1207         }
1208         if(pants == false){
1209             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
1210             
1211             if(colorChoice == 1){
1212                 pantsColor = "Red";
1213             }
1214             if(colorChoice == 2){
1215                 pantsColor = "Orange";
1216             }
1217             if(colorChoice == 3){
1218                 pantsColor = "Yellow";
1219             }
1220             if(colorChoice == 4){
1221                 pantsColor = "Green";
1222             }
1223             if(colorChoice == 5){
1224                 pantsColor = "Blue";
1225             }
1226             if(colorChoice == 6){
1227                 pantsColor = "Purple";
1228             }
1229             if(colorChoice == 7){
1230                 pantsColor = "Black";
1231             }
1232             if(colorChoice == 8){
1233                 pantsColor = "White";
1234             }
1235             if(colorChoice == 9){
1236                 pantsColor = "Brown";
1237             }
1238             if(colorChoice == 10){
1239                 pantsColor = "Grey";
1240             }
1241             if(colorChoice == 11){
1242                 pantsColor = "Silver";
1243             }
1244             if(colorChoice == 12){
1245                 pantsColor = "Gold";
1246             }
1247             if(colorChoice == 13){
1248                 pantsColor = "Multicolor";
1249             }
1250         }
1251         if(coats == false){
1252             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
1253             
1254             if(colorChoice == 1){
1255                 coatsColor = "Red";
1256             }
1257             if(colorChoice == 2){
1258                 coatsColor = "Orange";
1259             }
1260             if(colorChoice == 3){
1261                 coatsColor = "Yellow";
1262             }
1263             if(colorChoice == 4){
1264                 coatsColor = "Green";
1265             }
1266             if(colorChoice == 5){
1267                 coatsColor = "Blue";
1268             }
1269             if(colorChoice == 6){
1270                 coatsColor = "Purple";
1271             }
1272             if(colorChoice == 7){
1273                 coatsColor = "Black";
1274             }
1275             if(colorChoice == 8){
1276                 coatsColor = "White";
1277             }
1278             if(colorChoice == 9){
1279                 coatsColor = "Brown";
1280             }
1281             if(colorChoice == 10){
1282                 coatsColor = "Grey";
1283             }
1284             if(colorChoice == 11){
1285                 coatsColor = "Silver";
1286             }
1287             if(colorChoice == 12){
1288                 coatsColor = "Gold";
1289             }
1290             if(colorChoice == 13){
1291                 coatsColor = "Multicolor";
1292             }
1293         }
1294         if(occassion == "Beach" || occassion == "Workout" || occassion == "Villanova Game" || occassion == "Party"){
1295             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
1296             accessory = true;
1297             if(colorChoice == 1){
1298                 accessoryColor = "Red";
1299             }
1300             if(colorChoice == 2){
1301                 accessoryColor = "Orange";
1302             }
1303             if(colorChoice == 3){
1304                 accessoryColor = "Yellow";
1305             }
1306             if(colorChoice == 4){
1307                 accessoryColor = "Green";
1308             }
1309             if(colorChoice == 5){
1310                 accessoryColor = "Blue";
1311             }
1312             if(colorChoice == 6){
1313                 accessoryColor = "Purple";
1314             }
1315             if(colorChoice == 7){
1316                 accessoryColor = "Black";
1317             }
1318             if(colorChoice == 8){
1319                 accessoryColor = "White";
1320             }
1321             if(colorChoice == 9){
1322                 accessoryColor = "Brown";
1323             }
1324             if(colorChoice == 10){
1325                 accessoryColor = "Grey";
1326             }
1327             if(colorChoice == 11){
1328                 accessoryColor = "Silver";
1329             }
1330             if(colorChoice == 12){
1331                 accessoryColor = "Gold";
1332             }
1333             if(colorChoice == 13){
1334                 accessoryColor = "Multicolor";
1335             }
1336         }
1337         
1338         
1339             try{
1340             Class.forName("com.mysql.cj.jdbc.Driver");
1341             sqlConn = DriverManager.getConnection(dataConn, username, password);                    
1342             Connection con = getConnection();
1343             String query1 = "SELECT * FROM whole_closet WHERE Type = 'Coats' AND Material = '" + material + "' AND Color = '" + coatsColor + "' AND Formality = '" + occassion + "' ORDER BY RAND() LIMIT 2"; 
1344             st = con.createStatement();
1345             rs = st.executeQuery(query1);
1346             SearchCloset searchCloset;
1347         
1348             while(rs.next())
1349             {
1350                 searchCloset = new SearchCloset(
1351                         rs.getInt("ID"),
1352                         rs.getString("Name"),
1353                         rs.getString("Type"),
1354                         rs.getString("Color"),
1355                         rs.getString("Pattern"),
1356                         rs.getString("Material"),
1357                         rs.getString("Formality"),
1358                         rs.getString("Activity")
1359                         );
1360                 searchCoats.add(searchCloset); 
1361                 
1362                 
1363             }//while
1364             
1365         }
1366             
1367         
1368             
1369         catch(Exception ex){
1370             JOptionPane.showMessageDialog(null, ex);
1371         }
1372             
1373         return searchCoats; 
1374     } 
1375     
1376 
1377     public void showCoats(){
1378         ArrayList<SearchCloset> list = coatSearch();
1379         DefaultTableModel model = (DefaultTableModel)OutfitOutput_Table.getModel();
1380         Object[] row = new Object[3];
1381         for(int i = 0; i <list.size(); i++){
1382             row[0] = list.get(i).getName();
1383             row[1] = list.get(i).getType();
1384             
1385             model.addRow(row);
1386         }
1387     }
1388         
1389     public ArrayList<SearchCloset> accSearch()
1390     {
1391         ArrayList<SearchCloset> searchAcc = new ArrayList<SearchCloset>();
1392         
1393         Statement st;
1394         ResultSet rs;
1395         
1396         
1397     
1398         boolean shirt = false;
1399         boolean pants = false;
1400         boolean shorts = false;
1401         boolean coats = false;
1402         boolean accessory = false;
1403     
1404         String material = "";
1405         String shirtColor = "";
1406         String pantsColor = "";
1407         String shortsColor = "";
1408         String coatsColor = "";
1409         String accessoryColor = "";
1410         
1411         var temp = tempDDwn.getSelectedItem().toString();
1412         var weather = weatherDDwn.getSelectedItem().toString();
1413         var occassion = occassionDDwn.getSelectedItem().toString();
1414         var actLevel = actLevelDDwn.getSelectedItem().toString();
1415         
1416         
1417          if(temp == "55-65" || temp == "45-55" || temp == "32-45" || temp == "<32"){
1418         shorts = true;
1419     }
1420     if(temp == "65-75" || temp == "75-85" || temp == "85-95" || temp == ">95"){
1421         pants = true;
1422         coats = true;
1423     }
1424     
1425 
1426         if(shirt == false){
1427             
1428             if(temp == "32-45" || temp == "<32"){
1429                 material = "Thick";
1430             }
1431             if(temp == "55-65" || temp == "45-55"){
1432                 material = "Medium";
1433             }
1434             if(temp == "65-75" || temp == "75-85"){
1435                 material = "Thin";
1436             }
1437             if(temp == "85-95" || temp == ">95"){
1438                 material = "Dri-fit";
1439             }
1440             if(actLevel == "High"){
1441                 material = "Dri-fit";
1442             }
1443             
1444             
1445             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
1446             
1447             if(colorChoice == 1){
1448                 shirtColor = "Red";
1449             }
1450             if(colorChoice == 2){
1451                 shirtColor = "Orange";
1452             }
1453             if(colorChoice == 3){
1454                 shirtColor = "Yellow";
1455             }
1456             if(colorChoice == 4){
1457                 shirtColor = "Green";
1458             }
1459             if(colorChoice == 5){
1460                 shirtColor = "Blue";
1461             }
1462             if(colorChoice == 6){
1463                 shirtColor = "Purple";
1464             }
1465             if(colorChoice == 7){
1466                 shirtColor = "Black";
1467             }
1468             if(colorChoice == 8){
1469                 shirtColor = "White";
1470             }
1471             if(colorChoice == 9){
1472                 shirtColor = "Brown";
1473             }
1474             if(colorChoice == 10){
1475                 shirtColor = "Grey";
1476             }
1477             if(colorChoice == 11){
1478                 shirtColor = "Silver";
1479             }
1480             if(colorChoice == 12){
1481                 shirtColor = "Gold";
1482             }
1483             if(colorChoice == 13){
1484                 shirtColor = "Multicolor";
1485             }
1486             
1487             if(occassion == "Beach"){
1488                 material = "Thin";
1489             } 
1490         }   
1491         if(shorts == false){
1492             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
1493             
1494             if(colorChoice == 1){
1495                 shortsColor = "Red";
1496             }
1497             if(colorChoice == 2){
1498                 shortsColor = "Orange";
1499             }
1500             if(colorChoice == 3){
1501                 shortsColor = "Yellow";
1502             }
1503             if(colorChoice == 4){
1504                 shortsColor = "Green";
1505             }
1506             if(colorChoice == 5){
1507                 shortsColor = "Blue";
1508             }
1509             if(colorChoice == 6){
1510                 shortsColor = "Purple";
1511             }
1512             if(colorChoice == 7){
1513                 shortsColor = "Black";
1514             }
1515             if(colorChoice == 8){
1516                 shortsColor = "White";
1517             }
1518             if(colorChoice == 9){
1519                 shortsColor = "Brown";
1520             }
1521             if(colorChoice == 10){
1522                 shortsColor = "Grey";
1523             }
1524             if(colorChoice == 11){
1525                 shortsColor = "Silver";
1526             }
1527             if(colorChoice == 12){
1528                 shortsColor = "Gold";
1529             }
1530             if(colorChoice == 13){
1531                 shortsColor = "Multicolor";
1532             }
1533         }
1534         if(pants == false){
1535             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
1536             
1537             if(colorChoice == 1){
1538                 pantsColor = "Red";
1539             }
1540             if(colorChoice == 2){
1541                 pantsColor = "Orange";
1542             }
1543             if(colorChoice == 3){
1544                 pantsColor = "Yellow";
1545             }
1546             if(colorChoice == 4){
1547                 pantsColor = "Green";
1548             }
1549             if(colorChoice == 5){
1550                 pantsColor = "Blue";
1551             }
1552             if(colorChoice == 6){
1553                 pantsColor = "Purple";
1554             }
1555             if(colorChoice == 7){
1556                 pantsColor = "Black";
1557             }
1558             if(colorChoice == 8){
1559                 pantsColor = "White";
1560             }
1561             if(colorChoice == 9){
1562                 pantsColor = "Brown";
1563             }
1564             if(colorChoice == 10){
1565                 pantsColor = "Grey";
1566             }
1567             if(colorChoice == 11){
1568                 pantsColor = "Silver";
1569             }
1570             if(colorChoice == 12){
1571                 pantsColor = "Gold";
1572             }
1573             if(colorChoice == 13){
1574                 pantsColor = "Multicolor";
1575             }
1576         }
1577         if(coats == false){
1578             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
1579             
1580             if(colorChoice == 1){
1581                 coatsColor = "Red";
1582             }
1583             if(colorChoice == 2){
1584                 coatsColor = "Orange";
1585             }
1586             if(colorChoice == 3){
1587                 coatsColor = "Yellow";
1588             }
1589             if(colorChoice == 4){
1590                 coatsColor = "Green";
1591             }
1592             if(colorChoice == 5){
1593                 coatsColor = "Blue";
1594             }
1595             if(colorChoice == 6){
1596                 coatsColor = "Purple";
1597             }
1598             if(colorChoice == 7){
1599                 coatsColor = "Black";
1600             }
1601             if(colorChoice == 8){
1602                 coatsColor = "White";
1603             }
1604             if(colorChoice == 9){
1605                 coatsColor = "Brown";
1606             }
1607             if(colorChoice == 10){
1608                 coatsColor = "Grey";
1609             }
1610             if(colorChoice == 11){
1611                 coatsColor = "Silver";
1612             }
1613             if(colorChoice == 12){
1614                 coatsColor = "Gold";
1615             }
1616             if(colorChoice == 13){
1617                 coatsColor = "Multicolor";
1618             }
1619         }
1620         if(occassion == "Beach" || occassion == "Workout" || occassion == "Villanova Game" || occassion == "Party"){
1621             int colorChoice = (int) ((Math.random() * (13 - 1)) + 1);
1622             accessory = true;
1623             if(colorChoice == 1){
1624                 accessoryColor = "Red";
1625             }
1626             if(colorChoice == 2){
1627                 accessoryColor = "Orange";
1628             }
1629             if(colorChoice == 3){
1630                 accessoryColor = "Yellow";
1631             }
1632             if(colorChoice == 4){
1633                 accessoryColor = "Green";
1634             }
1635             if(colorChoice == 5){
1636                 accessoryColor = "Blue";
1637             }
1638             if(colorChoice == 6){
1639                 accessoryColor = "Purple";
1640             }
1641             if(colorChoice == 7){
1642                 accessoryColor = "Black";
1643             }
1644             if(colorChoice == 8){
1645                 accessoryColor = "White";
1646             }
1647             if(colorChoice == 9){
1648                 accessoryColor = "Brown";
1649             }
1650             if(colorChoice == 10){
1651                 accessoryColor = "Grey";
1652             }
1653             if(colorChoice == 11){
1654                 accessoryColor = "Silver";
1655             }
1656             if(colorChoice == 12){
1657                 accessoryColor = "Gold";
1658             }
1659             if(colorChoice == 13){
1660                 accessoryColor = "Multicolor";
1661             }
1662         }
1663         
1664         
1665             try{
1666             Class.forName("com.mysql.cj.jdbc.Driver");
1667             sqlConn = DriverManager.getConnection(dataConn, username, password);                    
1668             Connection con = getConnection();
1669             String query1 = "SELECT * FROM whole_closet WHERE Type = 'Accessory' AND Material = '" + material + "' AND Color = '" + accessoryColor + "' AND Formality = '" + occassion + "' ORDER BY RAND() LIMIT 2"; 
1670             st = con.createStatement();
1671             rs = st.executeQuery(query1);
1672             SearchCloset searchCloset;
1673         
1674             while(rs.next())
1675             {
1676                 searchCloset = new SearchCloset(
1677                         rs.getInt("ID"),
1678                         rs.getString("Name"),
1679                         rs.getString("Type"),
1680                         rs.getString("Color"),
1681                         rs.getString("Pattern"),
1682                         rs.getString("Material"),
1683                         rs.getString("Formality"),
1684                         rs.getString("Activity")
1685                         );
1686                 searchAcc.add(searchCloset); 
1687                 
1688                 
1689             }//while
1690             
1691         }
1692             
1693         
1694             
1695         catch(Exception ex){
1696             JOptionPane.showMessageDialog(null, ex);
1697         }
1698             
1699         return searchAcc; 
1700     } 
1701     
1702 
1703     public void showAcc(){
1704         ArrayList<SearchCloset> list = accSearch();
1705         DefaultTableModel model = (DefaultTableModel)OutfitOutput_Table.getModel();
1706         Object[] row = new Object[3];
1707         for(int i = 0; i <list.size(); i++){
1708             row[0] = list.get(i).getName();
1709             row[1] = list.get(i).getType();
1710             
1711             model.addRow(row);
1712         }
1713     }
1714     
1715     public void upDateDB(){
1716         //mySQL connction to update DB and make sure everything is good in NetBeans for my client
1717         try{
1718             Class.forName("com.mysql.cj.jdbc.Driver");
1719             sqlConn = DriverManager.getConnection(dataConn, username, password);
1720             pst = sqlConn.prepareStatement("select * from whole_closet");
1721             
1722             rs = pst.executeQuery();
1723             ResultSetMetaData stData = rs.getMetaData();
1724             
1725             q = stData.getColumnCount();
1726             
1727             DefaultTableModel RecordTable = (DefaultTableModel)netBeansWholeClosetTbl.getModel();
1728                 RecordTable.setRowCount(0);
1729             
1730                 
1731                 while(rs.next()){
1732                     Vector columnData = new Vector();
1733                     
1734                     for(i = 0; i <= q; i++){
1735                        columnData.add(rs.getString("ID"));
1736                        columnData.add(rs.getString("Name"));
1737                        columnData.add(rs.getString("Type"));
1738                        columnData.add(rs.getString("Color"));
1739                        columnData.add(rs.getString("Material"));
1740                        columnData.add(rs.getString("Pattern"));
1741                        columnData.add(rs.getString("Formality"));
1742                        columnData.add(rs.getString("Activity"));
1743 
1744 
1745 
1746                     }
1747                     RecordTable.addRow(columnData);
1748                 }
1749          }
1750         catch (Exception ex){
1751             JOptionPane.showMessageDialog(null, ex);
1752         }
1753         
1754     }
1755     
1756     
1757     //=====================Function==========================
1758     
1759     @SuppressWarnings("unchecked")
1760     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
1761     private void initComponents() {
1762 
1763         jPanel1 = new javax.swing.JPanel();
1764         jPanel2 = new javax.swing.JPanel();
1765         jPanel3 = new javax.swing.JPanel();
1766         jPanel4 = new javax.swing.JPanel();
1767         jPanel5 = new javax.swing.JPanel();
1768         typeDDwn = new javax.swing.JComboBox<>();
1769         colorDDwn = new javax.swing.JComboBox<>();
1770         patternCheckBox = new javax.swing.JCheckBox();
1771         materialDDwn = new javax.swing.JComboBox<>();
1772         formalityDDwn = new javax.swing.JComboBox<>();
1773         whatToNameLabel = new javax.swing.JLabel();
1774         newClothesNameInput = new javax.swing.JTextField();
1775         jScrollPane1 = new javax.swing.JScrollPane();
1776         netBeansWholeClosetTbl = new javax.swing.JTable();
1777         addBtn = new javax.swing.JButton();
1778         deleteBtn = new javax.swing.JButton();
1779         updateBtn = new javax.swing.JButton();
1780         resetBtn = new javax.swing.JButton();
1781         exitBtn = new javax.swing.JButton();
1782         activityLevelDDwn = new javax.swing.JComboBox<>();
1783         jPanel11 = new javax.swing.JPanel();
1784         jLabel1 = new javax.swing.JLabel();
1785         jLabel2 = new javax.swing.JLabel();
1786         whatTemp = new javax.swing.JLabel();
1787         whatWeatherLabel = new javax.swing.JLabel();
1788         whatOccLabel = new javax.swing.JLabel();
1789         whatActLabel = new javax.swing.JLabel();
1790         finalOuputChoicesLabel = new javax.swing.JLabel();
1791         actLevelDDwn = new javax.swing.JComboBox<>();
1792         tempDDwn = new javax.swing.JComboBox<>();
1793         weatherDDwn = new javax.swing.JComboBox<>();
1794         occassionDDwn = new javax.swing.JComboBox<>();
1795         jScrollPane3 = new javax.swing.JScrollPane();
1796         OutfitOutput_Table = new javax.swing.JTable();
1797         createButton = new javax.swing.JButton();
1798 
1799         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
1800         getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
1801 
1802         jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 153, 0), 8));
1803         jPanel1.setAutoscrolls(true);
1804         jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
1805 
1806         jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 153, 0), 8));
1807         jPanel2.setAutoscrolls(true);
1808         jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
1809 
1810         jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 153, 0), 8));
1811         jPanel3.setAutoscrolls(true);
1812         jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
1813         jPanel2.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(720, 20, 240, 470));
1814 
1815         jPanel4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 153, 0), 8));
1816         jPanel4.setAutoscrolls(true);
1817         jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
1818 
1819         jPanel5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 153, 0), 8));
1820         jPanel5.setAutoscrolls(true);
1821         jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
1822         jPanel4.add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(720, 20, 240, 470));
1823 
1824         jPanel2.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(720, 20, 240, 470));
1825 
1826         typeDDwn.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
1827         typeDDwn.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Type:", "Shirt", "Pants", "Shorts", "Coats", "Accessory", " " }));
1828         jPanel2.add(typeDDwn, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 20, 140, 30));
1829 
1830         colorDDwn.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
1831         colorDDwn.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Color:", "Red", "Orange", "Yellow", "Green", "Blue", "Purple", "Black", "White", "Brown", "Grey", "Silver", "Gold", "Multicolor", " " }));
1832         jPanel2.add(colorDDwn, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 50, 140, 30));
1833 
1834         patternCheckBox.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
1835         patternCheckBox.setText("Pattern?");
1836         jPanel2.add(patternCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 180, -1, -1));
1837 
1838         materialDDwn.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
1839         materialDDwn.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Material:", "Thick", "Medium", "Thin", "Dri-fit", " " }));
1840         jPanel2.add(materialDDwn, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 80, 140, 30));
1841 
1842         formalityDDwn.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
1843         formalityDDwn.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Formality:", "Beach", "Business Casual", "Casual", "Formal", "Party", "Work", "Villanova Game", "Workout", " " }));
1844         jPanel2.add(formalityDDwn, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 110, 140, 30));
1845 
1846         whatToNameLabel.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
1847         whatToNameLabel.setText("What would you like to call this item?");
1848         jPanel2.add(whatToNameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 220, 350, -1));
1849 
1850         newClothesNameInput.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
1851         newClothesNameInput.addActionListener(new java.awt.event.ActionListener() {
1852             public void actionPerformed(java.awt.event.ActionEvent evt) {
1853                 newClothesNameInputActionPerformed(evt);
1854             }
1855         });
1856         jPanel2.add(newClothesNameInput, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 250, 350, -1));
1857 
1858         netBeansWholeClosetTbl.setModel(new javax.swing.table.DefaultTableModel(
1859             new Object [][] {
1860 
1861             },
1862             new String [] {
1863                 "ID", "Article Name"
1864             }
1865         ));
1866         netBeansWholeClosetTbl.addMouseListener(new java.awt.event.MouseAdapter() {
1867             public void mouseClicked(java.awt.event.MouseEvent evt) {
1868                 netBeansWholeClosetTblMouseClicked(evt);
1869             }
1870         });
1871         jScrollPane1.setViewportView(netBeansWholeClosetTbl);
1872 
1873         jPanel2.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 310, 350, 250));
1874 
1875         addBtn.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
1876         addBtn.setText("Add New");
1877         addBtn.addActionListener(new java.awt.event.ActionListener() {
1878             public void actionPerformed(java.awt.event.ActionEvent evt) {
1879                 addBtnActionPerformed(evt);
1880             }
1881         });
1882         jPanel2.add(addBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 10, 200, -1));
1883 
1884         deleteBtn.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
1885         deleteBtn.setText("Delete");
1886         deleteBtn.addActionListener(new java.awt.event.ActionListener() {
1887             public void actionPerformed(java.awt.event.ActionEvent evt) {
1888                 deleteBtnActionPerformed(evt);
1889             }
1890         });
1891         jPanel2.add(deleteBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 50, 200, -1));
1892 
1893         updateBtn.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
1894         updateBtn.setText("Update");
1895         updateBtn.addActionListener(new java.awt.event.ActionListener() {
1896             public void actionPerformed(java.awt.event.ActionEvent evt) {
1897                 updateBtnActionPerformed(evt);
1898             }
1899         });
1900         jPanel2.add(updateBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 90, 200, -1));
1901 
1902         resetBtn.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
1903         resetBtn.setText("Reset");
1904         resetBtn.addActionListener(new java.awt.event.ActionListener() {
1905             public void actionPerformed(java.awt.event.ActionEvent evt) {
1906                 resetBtnActionPerformed(evt);
1907             }
1908         });
1909         jPanel2.add(resetBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 130, 200, -1));
1910 
1911         exitBtn.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
1912         exitBtn.setText("Exit");
1913         exitBtn.addActionListener(new java.awt.event.ActionListener() {
1914             public void actionPerformed(java.awt.event.ActionEvent evt) {
1915                 exitBtnActionPerformed(evt);
1916             }
1917         });
1918         jPanel2.add(exitBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 170, 200, -1));
1919 
1920         activityLevelDDwn.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
1921         activityLevelDDwn.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Activity Level:", "Low", "Medium", "High" }));
1922         activityLevelDDwn.addActionListener(new java.awt.event.ActionListener() {
1923             public void actionPerformed(java.awt.event.ActionEvent evt) {
1924                 activityLevelDDwnActionPerformed(evt);
1925             }
1926         });
1927         jPanel2.add(activityLevelDDwn, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 140, 140, 30));
1928 
1929         jPanel1.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 130, 400, 580));
1930 
1931         jPanel11.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 153, 0), 8));
1932         jPanel11.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
1933 
1934         jLabel1.setFont(new java.awt.Font("Myanmar Sangam MN", 1, 48)); // NOI18N
1935         jLabel1.setText("Austin's Closet");
1936         jPanel11.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 20, 333, -1));
1937 
1938         jPanel1.add(jPanel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, 400, 100));
1939 
1940         jLabel2.setFont(new java.awt.Font("Lucida Grande", 1, 36)); // NOI18N
1941         jLabel2.setText("Create Outfit:");
1942         jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 10, -1, -1));
1943 
1944         whatTemp.setText("What is today's average temperature?");
1945         jPanel1.add(whatTemp, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 60, -1, -1));
1946 
1947         whatWeatherLabel.setText("What is the weather today?");
1948         jPanel1.add(whatWeatherLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 120, -1, -1));
1949 
1950         whatOccLabel.setText("What occasion are you planning for?");
1951         jPanel1.add(whatOccLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 180, -1, -1));
1952 
1953         whatActLabel.setText("What is your level of activity today?");
1954         jPanel1.add(whatActLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 240, -1, -1));
1955 
1956         finalOuputChoicesLabel.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
1957         finalOuputChoicesLabel.setText("Here are your 2 outfit options:");
1958         jPanel1.add(finalOuputChoicesLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 420, -1, -1));
1959 
1960         actLevelDDwn.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "   ", "Low", "Medium", "High" }));
1961         jPanel1.add(actLevelDDwn, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 260, -1, -1));
1962 
1963         tempDDwn.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "  ", "<32", "32-45", "45-55", "55-65", "65-75", "75-85", "85-95", ">95" }));
1964         jPanel1.add(tempDDwn, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 80, -1, -1));
1965 
1966         weatherDDwn.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "   ", "Sunny", "Partly Cloudy", "Raining/Chance of Rain", "Snowing/Chance of Snow" }));
1967         jPanel1.add(weatherDDwn, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 140, -1, -1));
1968 
1969         occassionDDwn.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "  ", "Beach", "Business Casual", "Casual", "Formal", "Party", "Work", "Villanova Game", "Workout", " " }));
1970         jPanel1.add(occassionDDwn, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 200, -1, -1));
1971 
1972         OutfitOutput_Table.setModel(new javax.swing.table.DefaultTableModel(
1973             new Object [][] {
1974 
1975             },
1976             new String [] {
1977                 "Name", "Type"
1978             }
1979         ));
1980         jScrollPane3.setViewportView(OutfitOutput_Table);
1981 
1982         jPanel1.add(jScrollPane3, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 460, 510, 140));
1983 
1984         createButton.setText("Create Outfit");
1985         createButton.addActionListener(new java.awt.event.ActionListener() {
1986             public void actionPerformed(java.awt.event.ActionEvent evt) {
1987                 createButtonActionPerformed(evt);
1988             }
1989         });
1990         jPanel1.add(createButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 340, -1, -1));
1991 
1992         getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 980, 730));
1993 
1994         pack();
1995         setLocationRelativeTo(null);
1996     }// </editor-fold>                        
1997 
1998     private void newClothesNameInputActionPerformed(java.awt.event.ActionEvent evt) {                                                    
1999         // TODO add your handling code here:
2000     }                                                   
2001     private JFrame frame;
2002     private void exitBtnActionPerformed(java.awt.event.ActionEvent evt) {                                        
2003         //to exit the program
2004         frame = new JFrame("Exit");
2005         if (JOptionPane.showConfirmDialog(frame, "Confirm if you want to exit.", "MySQL Connector",
2006             JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
2007         {
2008             System.exit(0);
2009         }
2010     }                                       
2011 
2012     private void resetBtnActionPerformed(java.awt.event.ActionEvent evt) {                                         
2013             //resets the input fields for my user
2014             typeDDwn.setSelectedIndex(0);
2015             colorDDwn.setSelectedIndex(0);
2016             materialDDwn.setSelectedIndex(0);
2017             formalityDDwn.setSelectedIndex(0);
2018             activityLevelDDwn.setSelectedIndex(0);
2019             patternCheckBox.setSelected(false);
2020             newClothesNameInput.setText("");
2021     }                                        
2022 
2023     private void addBtnActionPerformed(java.awt.event.ActionEvent evt) {                                       
2024            //add button uses mySQL and Netbeans to upload to DB and also to JTable
2025         try{
2026                 Class.forName("com.mysql.cj.jdbc.Driver");
2027                 sqlConn = DriverManager.getConnection(dataConn, username, password);
2028                 pst = sqlConn.prepareStatement("insert into whole_closet(Type, Color, Pattern, Material, Formality, Activity, Name) VALUES (?, ?, ?, ?, ?, ?, ?)");
2029                         
2030                 pst.setString(1, typeDDwn.getSelectedItem().toString());
2031                 pst.setString(2, colorDDwn.getSelectedItem().toString());
2032                 pst.setBoolean(3, patternCheckBox.isSelected());
2033                 pst.setString(4, materialDDwn.getSelectedItem().toString());
2034                 pst.setString(5, formalityDDwn.getSelectedItem().toString());
2035                 pst.setString(6, activityLevelDDwn.getSelectedItem().toString());
2036                 pst.setString(7, newClothesNameInput.getText());
2037                 
2038                 pst.executeUpdate();
2039                 JOptionPane.showMessageDialog(this, "New item added");
2040                 upDateDB();
2041                 
2042             }
2043             catch (Exception ex){
2044             JOptionPane.showMessageDialog(null, ex);
2045         }          
2046     }                                      
2047 
2048     private void updateBtnActionPerformed(java.awt.event.ActionEvent evt) {                                          
2049        //basically to update the DB and in MySQL and the table in NB so there are no issues when outputting outfits 
2050         try{
2051                 Class.forName("com.mysql.cj.jdbc.Driver");
2052                 sqlConn = DriverManager.getConnection(dataConn, username, password);
2053                 pst = sqlConn.prepareStatement("update whole_closet set Type =?, Color =?, Pattern =?, Material =?, Formality =?, Activity =?, Name =?");
2054                         
2055                 pst.setString(1, typeDDwn.getSelectedItem().toString());
2056                 pst.setString(2, colorDDwn.getSelectedItem().toString());
2057                 pst.setBoolean(3, patternCheckBox.isSelected());
2058                 pst.setString(4, materialDDwn.getSelectedItem().toString());
2059                 pst.setString(5, formalityDDwn.getSelectedItem().toString());
2060                 pst.setString(6, activityLevelDDwn.getSelectedItem().toString());
2061                 pst.setString(7, newClothesNameInput.getText());
2062                 
2063                 pst.executeUpdate();
2064                 JOptionPane.showMessageDialog(this, "Closet updated");
2065                 upDateDB();
2066                 
2067             }
2068             catch (Exception ex){
2069             JOptionPane.showMessageDialog(null, ex);
2070             }
2071         }                                         
2072 
2073     private void netBeansWholeClosetTblMouseClicked(java.awt.event.MouseEvent evt) {                                                    
2074         //this is when you click the table to delete, it notes what you select and finds it in DB
2075         //to delete it when you run the deletebtn method
2076         DefaultTableModel RecordTable = (DefaultTableModel)netBeansWholeClosetTbl.getModel();
2077         int SelectedRows = netBeansWholeClosetTbl.getSelectedRow();
2078         
2079         typeDDwn.setSelectedItem(RecordTable.getValueAt(SelectedRows, 1).toString());
2080         colorDDwn.setSelectedItem(RecordTable.getValueAt(SelectedRows, 2).toString());
2081         patternCheckBox.setText(RecordTable.getValueAt(SelectedRows, 3).toString());
2082         materialDDwn.setSelectedItem(RecordTable.getValueAt(SelectedRows, 4).toString());
2083         formalityDDwn.setSelectedItem(RecordTable.getValueAt(SelectedRows, 5).toString());
2084         activityLevelDDwn.setSelectedItem(RecordTable.getValueAt(SelectedRows, 6).toString());
2085         newClothesNameInput.setText(RecordTable.getValueAt(SelectedRows, 7).toString());
2086     }                                                   
2087 
2088     
2089     
2090 
2091     private void deleteBtnActionPerformed(java.awt.event.ActionEvent evt) {                                          
2092         //this is for deleting from the table in NB and in MYSQL
2093         DefaultTableModel RecordTable = (DefaultTableModel)netBeansWholeClosetTbl.getModel();
2094         int SelectedRows = netBeansWholeClosetTbl.getSelectedRow();
2095         
2096         try{
2097             id = Integer.parseInt(RecordTable.getValueAt(SelectedRows, 0).toString());
2098             
2099             deleteItem = JOptionPane.showConfirmDialog(null, "Confirm if you want to delete this item.", 
2100             "Warning", JOptionPane.YES_NO_OPTION);
2101             if(deleteItem == JOptionPane.YES_OPTION){
2102                 //gives warning to make sure user does want to delete
2103                 
2104                 Class.forName("com.mysql.cj.jdbc.Driver");
2105                     sqlConn = DriverManager.getConnection(dataConn, username, password);
2106                     pst = sqlConn.prepareStatement("Delete from whole_closet where id =?");
2107                     //mySQL language in orange "" to execute command in mySQL
2108                 
2109                 pst.setInt(1, id);
2110                 pst.executeUpdate();
2111                 JOptionPane.showMessageDialog(this, "Closet updated, item has been deleted");
2112                 upDateDB();
2113                 
2114         typeDDwn.setSelectedItem("");
2115         colorDDwn.setSelectedItem("");
2116         patternCheckBox.setText("");
2117         materialDDwn.setSelectedItem("");
2118         formalityDDwn.setSelectedItem("");
2119         activityLevelDDwn.setSelectedItem("");
2120         newClothesNameInput.setText("");
2121             }
2122         }
2123         catch(ClassNotFoundException ex){
2124         java.util.logging.Logger.getLogger(AustinsClosetMySQL.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
2125         }   catch(SQLException ex){
2126             System.err.println(ex);
2127         }
2128   
2129     }                                         
2130 
2131     private void activityLevelDDwnActionPerformed(java.awt.event.ActionEvent evt) {                                                  
2132         // TODO add your handling code here:
2133     }                                                 
2134 
2135     private void createButtonActionPerformed(java.awt.event.ActionEvent evt) {                                             
2136       //this button takes all the methods above to create an outfit in the NetBeans table
2137        showShirts();
2138        showShorts();
2139        showPants();
2140        showCoats();
2141        showAcc();
2142        initComponents();
2143     }                                            
2144 
2145     /**
2146      * @param args the command line arguments
2147      */
2148     public static void main(String args[]) {
2149         /* Set the Nimbus look and feel */
2150         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
2151         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
2152          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
2153          */
2154         try {
2155             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
2156                 if ("Nimbus".equals(info.getName())) {
2157                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
2158                     break;
2159                 }
2160             }
2161         } catch (ClassNotFoundException ex) {
2162             java.util.logging.Logger.getLogger(AustinsClosetMySQL.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
2163         } catch (InstantiationException ex) {
2164             java.util.logging.Logger.getLogger(AustinsClosetMySQL.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
2165         } catch (IllegalAccessException ex) {
2166             java.util.logging.Logger.getLogger(AustinsClosetMySQL.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
2167         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
2168             java.util.logging.Logger.getLogger(AustinsClosetMySQL.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
2169         }
2170         //</editor-fold>
2171 
2172         /* Create and display the form */
2173         java.awt.EventQueue.invokeLater(new Runnable() {
2174             public void run() {
2175                 new AustinsClosetMySQL().setVisible(true);
2176             }
2177         });
2178 }
2179 
2180     // Variables declaration - do not modify                     
2181     private javax.swing.JTable OutfitOutput_Table;
2182     private javax.swing.JComboBox<String> actLevelDDwn;
2183     private javax.swing.JComboBox<String> activityLevelDDwn;
2184     private javax.swing.JButton addBtn;
2185     private javax.swing.JComboBox<String> colorDDwn;
2186     private javax.swing.JButton createButton;
2187     private javax.swing.JButton deleteBtn;
2188     private javax.swing.JButton exitBtn;
2189     private javax.swing.JLabel finalOuputChoicesLabel;
2190     private javax.swing.JComboBox<String> formalityDDwn;
2191     private javax.swing.JLabel jLabel1;
2192     private javax.swing.JLabel jLabel2;
2193     private javax.swing.JPanel jPanel1;
2194     private javax.swing.JPanel jPanel11;
2195     private javax.swing.JPanel jPanel2;
2196     private javax.swing.JPanel jPanel3;
2197     private javax.swing.JPanel jPanel4;
2198     private javax.swing.JPanel jPanel5;
2199     private javax.swing.JScrollPane jScrollPane1;
2200     private javax.swing.JScrollPane jScrollPane3;
2201     private javax.swing.JComboBox<String> materialDDwn;
2202     private javax.swing.JTable netBeansWholeClosetTbl;
2203     private javax.swing.JTextField newClothesNameInput;
2204     private javax.swing.JComboBox<String> occassionDDwn;
2205     private javax.swing.JCheckBox patternCheckBox;
2206     private javax.swing.JButton resetBtn;
2207     private javax.swing.JComboBox<String> tempDDwn;
2208     private javax.swing.JComboBox<String> typeDDwn;
2209     private javax.swing.JButton updateBtn;
2210     private javax.swing.JComboBox<String> weatherDDwn;
2211     private javax.swing.JLabel whatActLabel;
2212     private javax.swing.JLabel whatOccLabel;
2213     private javax.swing.JLabel whatTemp;
2214     private javax.swing.JLabel whatToNameLabel;
2215     private javax.swing.JLabel whatWeatherLabel;
2216     // End of variables declaration                   
2217 }
2218 
2219 
2220 
2221 
2222 
2223 
2224