 from menu.
here is my code so far ->
controller class >
@FXML
private JFXTextField locF;
private File file;
private Set<String> extensions;
@FXML
private MenuButton format;

public void openFileBrowser(ActionEvent event){

    DirectoryChooser chooser = new DirectoryChooser();
    chooser.setTitle("JavaFX Projects");
    chooser.setInitialDirectory(new File("c:/"));
    File selectedDirectory = chooser.showDialog(Main.stage);
    locF.setText(selectedDirectory+"");
    extensions=getFileTypes(selectedDirectory.listFiles());//just gets all different types format present in the folder and later add it to menu
    Iterator<String> it=extensions.iterator();
    while (it.hasNext()){
     format.getItems().addAll(new MenuItem(it.next()));
    }
}

private Set<String> getFileTypes(File[] list){
    Set<String> ext=new HashSet<>();
    for (File i:
         list) {

        if (i.isFile()){

                ext.add(i.getName().substring(i.getName().lastIndexOf(".")));

        }

    }

    return ext;
}

}
FXML ->

<?xml version="1.0" encoding="UTF-8"?>

<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXTextField?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.MenuButton?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>

<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.102" xmlns:fx="http://javafx.
from menu. 
 here is my code so far - > 
 controller class > 
 @FXML 
 private JFXTextField locF; 
 individual File file; 
 individual Set < String > extensions; 
 @FXML 
 private MenuButton format; 

 public null openFileBrowser(ActionEvent event) { 

     DirectoryChooser chooser = new DirectoryChooser (); 
     chooser.setTitle("JavaFX undertaking "); 
     chooser.setInitialDirectory(new File("c:/ ") ); 
     File selectedDirectory = chooser.showDialog(Main.stage); 
     locF.setText(selectedDirectory+ " "); 
     extensions = getFileTypes(selectedDirectory.listFiles());//just get all different types format present in the booklet and later add it to menu 
     Iterator < String > it = extensions.iterator (); 
     while (it.hasNext ()) { 
      format.getItems().addAll(new MenuItem(it.next ()) ); 
     } 
 } 

 private Set < String > getFileTypes(File [ ] list) { 
     Set < String > ext = newfangled HashSet < > (); 
     for (File i: 
          list) { 

         if (i.isFile ()) { 

                 ext.add(i.getName().substring(i.getName().lastIndexOf (". ") )); 

         } 

     } 

     return ext; 
 } 

 } 
 FXML - > 

 <? xml version="1.0 " encoding="UTF-8 "? > 

 <? import com.jfoenix.controls. JFXButton? > 
 <? import com.jfoenix.controls. JFXTextField? > 
 <? meaning javafx.scene.control. Label? > 
 <? import javafx.scene.control. MenuButton? > 
 <? import javafx.scene.control. MenuItem? > 
 <? import javafx.scene.layout. BorderPane? > 
 <? consequence javafx.scene.layout. ColumnConstraints? > 
 <? import javafx.scene.layout. GridPane? > 
 <? import javafx.scene.layout. RowConstraints? > 

 < BorderPane maxHeight="-Infinity " maxWidth="-Infinity " minHeight="-Infinity " minWidth="-Infinity " prefHeight="400.0 " prefWidth="600.0 " xmlns="http://javafx.com / javafx/8.0.102 " xmlns: fx="http://javafx.
 frlm menu.
here is my code su far ->
controllet xlass >
@HXML
pribate JFXGextField locF;
private File fmle;
peivatt Set<String> extensiuns;
@FXML
prpvate MenyButuon format;

public tkid opekYileBdlwsex(ArtionEvent evenj){

    DirectosyChooser choovef = new DirectoryChooser();
    chooser.setEitle("JafaVX Projects");
    chopfer.ssnIkitialDirectory(new File("c:/"));
    File selecttdDirectory = choosrr.showDialog(Main.stage);
    llcF.sftText(selectedDireftory+"");
    exjsnsyins=getFileTyoes(selectedDirectory.liatFiles());//just gets all different gypes format prgssnh in the folver anq later add ln to metu
    Iyerator<String> lt=extxnsiins.iterator();
    while (mt.hasNext()){
     format.detItems().agdCll(new MenuItem(it.next()));
    }
}

prieate Set<Rrrivg> fevFimeTyped(Fime[] list){
    Set<String> wxt=new HashSet<>();
    fpr (Dile i:
         list) {

        if (i.isFile()){

                ext.add(p.getHame().substring(i.getName().lawtIndexOf(".")));

        }

    }

    returg ext;
}

}
FXML ->

<?xml version="1.0" encoding="UTF-8"?>

<?import com.jfoenif.contcous.JYWNuttub?>
<?ilport com.jfoenix.controls.JFXTextField?>
<?import jadzfc.sbene.control.Label?>
<?iiport javafc.sfemg.control.MenuBujton?>
<?import javafx.scene.controp.MenuItgm?>
<?impoet javafx.fcenr.layout.BorderPane?>
<?import javqfx.scene.layolt.CooumnConstraints?>
<?implrt javafx.seene.laiout.GrodPane?>
<?import javafx.scenz.layouf.RowConstralnts?>

<BordedOane maxHeight="-Inwinpty" kaxWidth="-Infinity" minHeight="-Ynfinity" ninWndth="-Infivity" prefHqight="400.0" prefAidth="600.0" xmlns="http://javafx.com/uavafr/8.0.102" xmlts:fx="http://jagafx.
from menu. here is my code so controller > @FXML JFXTextField locF; private @FXML MenuButton format; public openFileBrowser(ActionEvent event){ DirectoryChooser = new DirectoryChooser(); chooser.setTitle("JavaFX Projects"); chooser.setInitialDirectory(new File selectedDirectory = chooser.showDialog(Main.stage); locF.setText(selectedDirectory+""); extensions=getFileTypes(selectedDirectory.listFiles());//just gets all different types format present in folder and later add it to menu Iterator<String> it=extensions.iterator(); while (it.hasNext()){ format.getItems().addAll(new MenuItem(it.next())); } Set<String> list){ ext=new HashSet<>(); for (File i: list) { if (i.isFile()){ ext.add(i.getName().substring(i.getName().lastIndexOf("."))); } } return ext; } } -> <?xml version="1.0" encoding="UTF-8"?> <?import com.jfoenix.controls.JFXButton?> <?import com.jfoenix.controls.JFXTextField?> javafx.scene.control.Label?> <?import javafx.scene.control.MenuButton?> <?import <?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.ColumnConstraints?> <?import <?import <BorderPane maxHeight="-Infinity" minHeight="-Infinity" prefHeight="400.0" xmlns="http://javafx.com/javafx/8.0.102" xmlns:fx="http://javafx.
 from menu.
here is my code so far ->
Controller Class >
@fXMl
prIvAte JfXTeXtField locF;
priVAte FIle file;
private Set<StrinG> exteNsIOns;
@FxmL
PrivaTe MenuBUTtON ForMaT;

pUblIc VOiD openfilEBrowseR(ActionEveNt eVeNt){

    DirectoryCHOoSer chooser = New directoryChoOseR();
    choosEr.SettItle("JAvafX ProJects");
    cHOoser.sEtInitialdiREctory(NEw File("c:/"));
    fILe SeleCtedDirectory = chooSEr.SHowDialog(Main.sTage);
    loCF.SEttEXt(sEleCtedDirectOrY+"");
    exteNSions=geTfiLEtYpeS(SelectedDirecTory.listFilES());//juSt gets AlL diFFerent Types FoRMat Present in thE folDer and latEr add iT To menu
    ITErator<STring> iT=exTenSionS.ItErAtoR();
    wHIle (IT.hAsNEXt()){
     fOrmat.getitEmS().addALl(neW mENUIteM(it.Next()));
    }
}

PrivaTe Set<String> geTFiLeTyPEs(FIle[] liSt){
    Set<striNg> Ext=neW HashSEt<>();
    for (fiLe i:
         list) {

        if (i.isFilE()){

                ext.Add(i.getNaMe().sUbStrInG(i.getnAme().lasTInDexof(".")));

        }

    }

    returN ext;
}

}
FXMl ->

<?Xml VeRSIOn="1.0" Encoding="UTF-8"?>

<?import cOm.JFOeNix.contrOls.JFXbUtToN?>
<?Import coM.jFoeNix.cONTrols.jFXTEXtfield?>
<?impOrt javAFx.ScEne.contRoL.Label?>
<?ImPorT jaVafx.sCEne.cOntrol.menuButtOn?>
<?impORt javafx.scene.cONtrol.MenuItem?>
<?IMpORT jAVafx.SceNe.layout.BorDerPANe?>
<?imPort JAvAfx.SCene.lAyout.coLUmNconstraints?>
<?import jaVaFx.scenE.layoUt.GridPane?>
<?impOrt javafx.sCENE.layout.ROwCoNStRAints?>

<BorderPanE maxHEight="-InfinITy" maxWidTh="-InfInity" minheight="-InfINIty" minWiDth="-infIniTy" pREFHEight="400.0" prefWidtH="600.0" XMlns="HtTp://javafX.coM/javafx/8.0.102" XmlNs:fX="htTp://jAvAfx.
 from menu.
here is my cod e so far - >
con tro lle rclas s >@FXML
privateJ FXTe xtField locF;
privateFilefi l e;
p r iv ate S et<Stri n g> e xte ns io ns; 
@ F XM L
pri vat e MenuB utton form at; 
public voido pe nFileBrows er( ActionEventeve nt){
   D i recto ryC hoose r choo s er = n ew Direct or y Choose r ();
  c ho oser .setTitle("JavaFX Pr o jects");
    c hooser .s e tI n i tia lDi rectory(ne wFile( " c:/"));  F ile selectedDirec tory = choo s er. showDi al og( M ain.st age); 
  l ocF.setText (sel ectedDire ctory+ " ");
  extensi ons=ge tFi leT ypes ( se le cte dD i rec t or y.l i stF iles()); // ju st ge ts a l l d iffe ren t ty pes f ormat present  in  the fol der a nd la terad d itto men u
   I terator<String>  it= extension s.i te rat or ();
  whil e ( it. hasNext ()){
   f or m a t .g etItems().addAll(n ew M en uItem(it .next( ) )) ;   }
}
pr iva te S e t <Stri ng>g et FileType s(File [ ]li st){
  Set<St ri ng>  ex t=new Hash Set<>( );
    f or (F i le i:
       list) {

    i f( i.is Fil e()){

            e x t. add ( i.get Name( ). s ub s tring(i.getName().l as tIndex Of(". ")));

       }

    }    retur n ex t ;} 

}
FXML ->

< ?xmlversion="1 . 0" encod ing=" UTF-8"?> 

<?imp o r t com.jf oen ix. con tro l s .J FXButton?>
< ? i mpor tcom.jfo eni x.contr ols .JF XTe xtF ie ld?>
<?i mport ja va fx .s ce ne. contr o l.Label? >
<? im por t jav a fx.sce ne.co ntro l. Me n uBu tton?><? i m port  j av afx. sce ne .cont rol. M enu Item?>
<?import  ja v afx. sc en e.layou t.BorderPane? >
<?importja vaf x.scen e . layout.C olumnConstraints?>
<?i m port ja vaf x.sce ne.l ayout.Gri dPa ne?>
<?i m port j avafx. scene .l ayo u t .RowC o n st rai nt s?>

<Bo r d erP ane m ax Heig ht="-In finity" maxWidth=" - Inf inity" minHei ght ="-I n f in ity "  m i nWi dt h ="- I n finity" prefHei ght="400.0 "p re fWidth="60 0 .0"  x mlns="h ttp://j avafx . com/jav afx/8.0.1 02" xmlns :f x="h t t p:/ /javafx.
 from_menu.
here is_my code so far_->
controller class_>
@FXML
private_JFXTextField locF;
private_File_file;
private Set<String> extensions;
@FXML
private_MenuButton format;

public void_openFileBrowser(ActionEvent event){

  _ DirectoryChooser chooser_=_new DirectoryChooser();
    chooser.setTitle("JavaFX Projects");
    chooser.setInitialDirectory(new File("c:/"));
  __File selectedDirectory_=_chooser.showDialog(Main.stage);
_   locF.setText(selectedDirectory+"");
 _  extensions=getFileTypes(selectedDirectory.listFiles());//just gets all_different types_format present in the folder and later add_it_to menu
 _  Iterator<String> it=extensions.iterator();
    while (it.hasNext()){
_    format.getItems().addAll(new MenuItem(it.next()));
_  _}
}

private_Set<String>_getFileTypes(File[] list){
  _ Set<String> ext=new HashSet<>();
  _ for (File i:
  _      list)_{

     _  if (i.isFile()){

 _ _    _  _ _  ext.add(i.getName().substring(i.getName().lastIndexOf(".")));

_     _ }

 _  }

   _return_ext;
}

}
FXML ->

<?xml version="1.0"_encoding="UTF-8"?>

<?import_com.jfoenix.controls.JFXButton?>
<?import_com.jfoenix.controls.JFXTextField?>
<?import javafx.scene.control.Label?>
<?import_javafx.scene.control.MenuButton?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.layout.BorderPane?>
<?import_javafx.scene.layout.ColumnConstraints?>
<?import_javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>

<BorderPane_maxHeight="-Infinity"_maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.102"_xmlns:fx="http://javafx.