Code I tried to do but it does not work:
JavaFX FXML Application:
salvar.setOnAction((ActionEvent e) -> {
Stage window = (Stage) cont.getScene().getWindow();
try {
String corpo = cont.getText();
FileWriter gravarFile = new FileWriter(corpo, false);
PrintWriter gravar = new PrintWriter(gravarFile + ".txt");
gravar.write(corpo);
gravar.close();
}catch(IOException ex) {
System.out.println("Conteudo não poderá ser gravado!");
ex.printStackTrace();
}
});
What's wrong with this code above?