13.19 TitledPane

Cliquez içi pour plus de vidéos disponibles sur notre chaine youtube !

So, the last control we will look at in this section is the TitledPane. The TitledPane allows you to create a panel with a title that can be opened or closed. So let’s add one to our Grid and see what it looks like, I’ll give it a title and add a label just so you know what it really looks like. So I’m going to go down here and start typing Titled Pane The text is equal "title pane" And as always with a GridPane.rowIndex = 3 and Gridpane.columnIndex = "2" And inside we’re going a label too. So, label there will be a text = "Label in the title pane" If we run our program. And we have our TitledPane. We can close it and open it as you can see here. And of course, this is one of the features of a "TitledPane" that we can actually click on and that can be opened or closed so that you can actually hide the content, which can be very useful depending on the application you create. So you’re probably asking, well, that sounds good, but where would we actually use it. Well, we can use it alone. As you’ve seen, we can actually add accordion control to it. Thus, an accordion control allows to manage multiple panes and allows the user to display them one at a time. So this is probably something you would use in an application, so let’s add two more TitledPanes and put them in an accordion just so you can see what it looks like. What we actually do is put it in an accordion. So we will click here and type accordion and remove the rowIndex and columnIndex in tiltedPane and put it on our accordion. our accordion will also have a columnSpane = 2 Now inside we will put the tag And inside this tag we will move our titledPane. We will also add two others just to see what many look like. So now, if I raise that and take a look. And you can see that we now have three. We can only open one at a time. So it kind of automatically closes the others. So this can be a very good way to add additional content on a single screen and allow the user to enter only one at a time to perform the processing you want to perform for this TitledPane.And one of the other things you may wantbe done because you probably noticed it when we first executed it, I will run it again. All have been closed by default. And it would probably be useful to make one by default, when the user interface opens for the first time, so that you can somehow have a default pane so that the user can actually see what it contains. So, for example the titledPane 2 I’m going to give it as an ID So, it’s going to be FX: ID So, you assign an ID to the one you want, then you get here in the accordion and you go calling the id here with the Expanded Pane method. And if we run the program again. Now you can see that title 2 is now open on the screen. That was all for checks, I’ll tell you next time.