I learned that you can replace Scanner with getText() in getText() , but I do not know how it works.

For example, I need to int d; I recorded the value written in my JTextField burl .

  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

2 answers 2

 @FXML private TextField file; @FXML protected void file() throws Exception { (label_text = new Label()).setText(file.getText()); } 

main.fxml

 <TextField fx:id="file" ... onAction="#file" /> 

Here is an example of using this function, reading String data from a TextField block. Akshony can put down any of the final filling of the character, before pressing the button, so that the parameter is recorded in the label_text, use it from there.

    Yes, that's right, you can replace with getText() - it reads a string from jTextField and converts it to a number format:

     Integer d = Integer.parseInt(burl.getText()) 

    An example of its use when you click on the JButton click :

     click.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Integer d = Integer.parseInt(burl.getText()); } });