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