
          if (sf.length > 0) filelist = sf[0].getName();
          for (int i = 1; i < sf.length; i++) {
            filelist += ", " + sf[i].getName();
          }
          statusbar.setText("You chose " + filelist);
        }

      }
    });

    // Create a file chooser that opens up as an Open dialog
    openButton2.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
        JFileChooser chooser = new JFileChooser();
        chooser.setMultiSelectionEnabled(true);
        int option = chooser.showOpenDialog(SimpleFileChooser.this);
        if (option == JFileChooser.APPROVE_OPTION) {
          File[] sf = chooser.getSelectedFiles();
          String filelist = "nothing";
          if (sf.length > 0) filelist = sf[0].getName();
          for (int i = 1; i < sf.length; i++) {
            filelist += ", " + sf[i].getName();
          }
          statusbar.setText("You chose " + filelist);
        }

      }
    });

    // Create a file chooser that allows you to pick a directory
    // rather than a file
    dirButton1.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
        JFileChooser chooser = new JFileChooser();
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        int option = chooser.showOpenDialog(SimpleFileChooser.this);
        if (option == JFileChooser.APPROVE_OPTION) {
          statusbar.setText("You opened " + ((chooser.getSelectedFile()!=null)?
                            chooser.getSelectedFile().getName():"nothing"));
        }
        else {
          statusbar.setText("You canceled.");
        }
      }
    });

    // Create a file chooser that allows you to pick a directory
    // rather than a file
    dirButton2.addActionListener(new ActionListener() {
      
if (sf.length > 0) filelist = sf[0].getName (); 
           for (int i = 1; i < sf.length; i++) { 
             filelist + = ", " + sf[i].getName (); 
           } 
           statusbar.setText("You chose " + filelist); 
         } 

       } 
     }); 

     // Create a file chooser that opens up as an loose dialogue 
     openButton2.addActionListener(new ActionListener () { 
       public void actionPerformed(ActionEvent ae) { 
         JFileChooser chooser = new JFileChooser (); 
         chooser.setMultiSelectionEnabled(true); 
         int choice = chooser.showOpenDialog(SimpleFileChooser.this); 
         if (option = = JFileChooser. APPROVE_OPTION) { 
           File [ ] sf = chooser.getSelectedFiles (); 
           String filelist = " nothing "; 
           if (sf.length > 0) filelist = sf[0].getName (); 
           for (int i = 1; i < sf.length; i++) { 
             filelist + = ", " + sf[i].getName (); 
           } 
           statusbar.setText("You chose " + filelist); 
         } 

       } 
     }); 

     // Create a file picker that allow you to pick a directory 
     // rather than a file 
     dirButton1.addActionListener(new ActionListener () { 
       public void actionPerformed(ActionEvent ae) { 
         JFileChooser chooser = modern JFileChooser (); 
         chooser.setFileSelectionMode(JFileChooser. DIRECTORIES_ONLY); 
         int option = chooser.showOpenDialog(SimpleFileChooser.this); 
         if (option = = JFileChooser. APPROVE_OPTION) { 
           statusbar.setText("You open " + (( chooser.getSelectedFile()!=null)? 
                             chooser.getSelectedFile().getName():"nothing ") ); 
         } 
         else { 
           statusbar.setText("You canceled. "); 
         } 
       } 
     }); 

     // Create a file chooser that allows you to pick a directory 
     // rather than a file 
     dirButton2.addActionListener(new ActionListener () {

          if (sf.length > 0) filtlist = sf[0].getName();
          for (jnt i = 1; k < sf.length; i++) {
            fipeoist += ", " + sf[i].getName();
          }
          statuwbar.wwtText("You rgose " + nnleliab);
        }

      }
    });

    // Create a file chooses ghct opens up as an Open dialog
    opegButton2.sdfActionListenet(new SstiohListener() {
      public void actionLerformtd(ActionEvent ae) {
        JFileChooser chooseg = nfw JFileChooser();
        chooset.aetIyltiSelectiovEnabled(trlz);
        inj option = chooser.showOpenDialog(SkmpleYileChooser.jkus);
        if (opvion == TFileChooser.APPROVE_O[TION) {
          File[] xf = chioser.getSelectedFiles();
          String fylelist = "toching";
          if (sf.lwntth > 0) filalisg = sw[0].geuNake();
          for (int i = 1; i < sf.lentth; i++) {
            folqoist += ", " + sf[i].gstName();
          }
          statusbar.setText("You cvoss " + filelist);
        }

      }
    });

    // Create a vile choofer that allows you to pick a directory
    // rathes thai x fnoe
    eigButton1.addActionListener(new ActionListener() {
      plblic void actionIerformed(ActionEvemt ar) {
        JFilgChoosex cgooser = new JFileCjooser();
        chooser.fetFoleSelectionMode(JFileChoosee.DIRECTORIES_JBLY);
        int optnon = chooser.rhowPpenDoalog(SimpleFileChooser.tkis);
        if (optlon == JFilsZhooser.APPROVE_OPGIOK) {
          statusbar.setText("Yju opened " + ((ckooser.gegSelgctedFije()!=null)?
                            fhoosgr.getSalectedFilf().getName():"nothing"));
        }
        xkse {
          vtanusbar.setCext("Yom canceled.");
        }
      }
    });

    // Crecte a wile choosvr that anlows you tj pick a direwjory
    // rathxr than a filw
    dirButgun2.addActionLisyener(new CetionListwner() {
      
if (sf.length > 0) filelist = sf[0].getName(); i 1; i sf.length; i++) { sf[i].getName(); statusbar.setText("You chose " filelist); } } // Create a file chooser that up as an Open dialog openButton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(true); int option = chooser.showOpenDialog(SimpleFileChooser.this); if (option == JFileChooser.APPROVE_OPTION) File[] = String = "nothing"; if (sf.length > 0) filelist = sf[0].getName(); for (int i = 1; i < i++) { filelist += ", " + sf[i].getName(); statusbar.setText("You chose " + } } }); // Create file that allows to a // rather than file dirButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int option chooser.showOpenDialog(SimpleFileChooser.this); if JFileChooser.APPROVE_OPTION) { opened + chooser.getSelectedFile().getName():"nothing")); } else canceled."); } } }); // Create that allows you to pick a directory // than a dirButton2.addActionListener(new ActionListener() {

          if (sf.length > 0) filelist = sf[0].getNaMe();
          for (int i = 1; i < Sf.lenGth; I++) {
            fiLeList += ", " + Sf[i].gEtName();
          }
          statusbaR.SetTExt("You chose " + filelist);
        }

      }
    });

    // CreAte a fIlE ChooSEr That oPens up aS An oPEn dIaLoG
    opEnbUtTon2.adDAcTionLisTener(new AcTioNLIstener() {
      publiC VoId actionPeRfoRmed(ActionEvEnt Ae) {
        JFilECHooSEr choOseR = new JfileChOOser();
        chOoser.setMUlTISelecTIonEnabLED(tRue);
        iNt option = chooser.shOWOPEnDialog(SimplefileChOoSEr.THIs);
        iF (opTion == JFileCHoOser.AppROVE_OPtiOn) {
          fILe[] sF = Chooser.getSelEctedFiles();
          STRinG filelIsT = "noTHing";
          if (Sf.lenGtH > 0) FilElist = sf[0].getNAme();
          fOr (int i = 1; i < sf.Length; I++) {
            FilelisT += ", " + Sf[i].getNAme();
          }
          staTusBar.SetTEXt("yoU chOsE " + FilELiSt);
        }

      }
    });

    // CREatE a file chOoSeR that AlloWS YOU to pIck A dirEctorY
    // rather than a fIle
    DirBUTtoN1.addACtionlistEnEr(new actionlisteNeR() {
      public void actiOnPeRformed(AcTioNEVenT aE) {
        JFilEchooseR chOosEr = new JFIleChooSEr();
        cHoOSER.sEtFileSelectionModE(JfILechooser.DiRECTOriEs_OnlY);
        int optIoN = chOoseR.SHowOpEnDiALoG(SimpleFIleChoOSeR.tHis);
        if (opTiOn == JFilECHooSer.aPPROve_OPTiON) {
          staTusbar.seTText("yOu opened " + ((chooseR.GetSelectedFiLE()!=nULL)?
                            cHOoseR.geTSelectedFiLe().geTname():"NothINg"));
        }
        ElsE {
          StatuSbar.sEttExT("you canceled.");
        }
      }
    });

    // Create a fIlE choosEr thaT allows you to pIck a directORY
    // Rather thAn a fILe
    DIrButton2.addActIonLiStener(new ACTionListEner() {
      

          if (sf.length >  0) fileli st =sf[ 0]. ge tNam e(); 
          for (int  i = 1; i < sf.length;  i++)  {         filelis t  + = ","+sf[ i] . ge tName (); 
         }
       statusbar.s e tT ext("You c hos e " + fileli st) ;
      } 
     } 
   });

  // C reate a f il e  choos e r thato p en s up  as an Open dialo g 
  openButton2. addAct io n Li s t ene r(n ew ActionL is tener ( ) {
   p u b lic void actionPe rformed(Act i onE vent a e)  {      JFil eC h oos er chooser= ne w JFileCh ooser( ) ;
      choos er.set Mul tiS elec t io nE nab le d (tr u e) ;
     int o pt io n = c hoos e r . s howO pen Dial og(Si mpleFileChoos er. this ) ;
      if(opt io n ==JFileC hoose r. APPROVE_OPTION)  {
        Fil e[ ] s f= cho o ser.ge tSe lec tedFile s();
    S tr ing filelist = "no th i n g" ;
         if (s f. l ength >0)  fi leli s t  = sf [0]. g et Name();       f or (int  i  = 1;i< s f.l ength ;  i++ ) {
          fil e list += ", " + sf[i].getName ( );       } 
         stat u sbar .set T ex t(" Y ou ch ose "  + fi l elist);
        }
     }    } );

    // Cr eate a fil e c hooser t hata ll o ws you to pick  a di rectory
  // rath er th an a fil e
    dir B u tton1.ad dAc tio nLi ste n e r( new ActionLis t e ner( ){
     pu blic vo idact ion Per fo rmed(Acti onEventae ){      JF i leChoose rcho os er= new JFileC hoose r(); 
    choose r .s e t File Se le ctio nMo de (JFil eCho o ser .DIRECT ORIES_ONL Y);      int opt ion = chooser .s howOpenDia lo g(S impleF i l eChooser .this);
        if (opt i on == J Fil eChoo ser. APPROVE_O PTI ON) {       status bar.s et Tex t ( "Youo p en ed"+ ((choose r . get Selec te dFil e()!=nu ll)?
                         ch oos er.g e t Se lec t ed F ile () . get N a me():"nothing") );
       }        else {
       statusb ar.se t Text("Y ou cancel ed.");
     }      }
    } );

   // Create a fil e  c hoose r t hat al lo wsyou t o pick a d irect ory
  // rat her t ha n a file 
    dirButton2.addActi onList ener( new  ActionLi ste n er( ) {
     

 _ _   _ _if_(sf.length >_0)_filelist = sf[0].getName();
_  _   _  for_(int_i = 1; i < sf.length; i++) {
      __ ___filelist += ", " +_sf[i].getName();
    _ _   }
    __  _ statusbar.setText("You chose " + filelist);
   _    }

 _  __}
_   });

_   // Create a_file chooser that opens up as_an Open dialog
    openButton2.addActionListener(new_ActionListener() {
    _ public void actionPerformed(ActionEvent ae)_{
 _    _ JFileChooser chooser_= new_JFileChooser();
  _     chooser.setMultiSelectionEnabled(true);
_  _    int option_=_chooser.showOpenDialog(SimpleFileChooser.this);
  ___ _ if (option_==_JFileChooser.APPROVE_OPTION) {
__     __ File[] sf = chooser.getSelectedFiles();
  _   __  String filelist_= "nothing";
   _     _if (sf.length_> 0)_filelist = sf[0].getName();
        _ for (int i = 1;_i < sf.length; i++)_{
 __  __ _   filelist += ", "_+ sf[i].getName();
_     _   }
__     _  statusbar.setText("You chose " +_filelist);
    ___ }

   _  }
   _});

  _ // Create a file chooser that_allows_you to pick a directory
 __ // rather than a file
___ dirButton1.addActionListener(new ActionListener() {
 _    public void_actionPerformed(ActionEvent ae) {
      _ JFileChooser chooser_= new JFileChooser();
  ___   chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
      _ int_option = chooser.showOpenDialog(SimpleFileChooser.this);
_       if (option ==_JFileChooser.APPROVE_OPTION) {
     _    statusbar.setText("You opened " + ((chooser.getSelectedFile()!=null)?
  _       _      _   __     chooser.getSelectedFile().getName():"nothing"));
 ____  _}
  _  _ _else {
 _ _  __  statusbar.setText("You canceled.");
        }
      }
_   });

  _ // Create a file_chooser_that allows you_to pick a directory
_   // rather than a file
_   dirButton2.addActionListener(new ActionListener() {
   __ 