title: JavaFX Button for FileInputStream?
body: <pre><code> runEncrypt.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
          @Override
          public void handle(ActionEvent event) {
  
                  File inputFile = new File("/Users/aktasberk/Desktop/hey");
                  File encryptedFile = new File("/Users/aktasberk/Desktop/Encrypted_"+inputFile.getName());
                  File decryptedFile = new File("/Users/aktasberk/Desktop/Decrypted_"+inputFile.getName());
  
                  try {
                      String key = "16BitKeyIsHere16";
                  CryptoUtils.encrypt(key, inputFile, encryptedFile);
                    CryptoUtils.decrypt(key, encryptedFile, decryptedFile);
                  } catch (CryptoException ex) {
                    System.out.println(ex.getMessage());
                  ex.printStackTrace();
                  }
          }
      });
  </code></pre>
  
  <p>Okay so I have an encryption&amp;decryption project, the encrypting and decrypting works fine but I have some problems using FileInputStream to get the file from directory, I have a browse button to do that but could not make it work, so as you can see in the code I get the input file manually.</p>
  
  <p>Below here is my browse button opening up a file dialog to let me choose a file.</p>
  
  <pre><code>browseEncrypt.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
          @Override
          public void handle(ActionEvent event) {
  
  
              File selectedFile = chooseEncrypt.showOpenDialog(primaryStage);
              if (selectedFile != null) {
                  encryptPath.setText(selectedFile.getPath());
                  primaryStage.show();
              }
          }
      });
  </code></pre>
  
  <p>I need to get the file from browse button instead of declaring it manually in the code, I can be more specific if info is needed, thanks.</p>