13.14 TextField
Cliquez içi pour plus de vidéos disponibles sur notre chaine youtube !Hello, now we will see the textField (text field) The text field gives the user the opportunity to enter information so that we can actually interpret these results and perform an action with these data. Now, a text field will generally not be longer than a few words, as it is a one-line field. So we’re going to add it in our GridPane. We’re going to start on a new line and put the text field in that first column. So, TextField, there’s going to be a row = 1 and column that starts with 0 first because we’re going to put another field in. This is the basic format of a text field. And when we execute we should see that we can type something into that field. Now, we can also initialize the field with text by defining the text property, but this can often be irritating unless we also add the code to delete the text as soon as the user places the cursor in the text field. Otherwise, the user must delete everything in the field before starting typing. Now, the text field class also contains copy, cut, and paste methods that allow us to copy, paste, or delete its contents in the clipboard. There is also a password field that comes, as you can imagine directly from the control of the text field.The only visual difference between the 2 is that a password field hides everything that has been typed there. And also its copy and cut methods do nothing, so you can’t copy and paste into a password field. Let’s add one to our GridPane below the textfield. PasswordField it will have a line = 1 and a colon = 1 We run it and we should see that it works as a normal text field. And we obviously get the stars or the little circles to indicate that it’s a password and we can’t see what’s typed. And again, it’s pretty much identical to a text field except for the fact that it hides what we type. That’s all for this video, it was small video on the text field I tell you next time.