so the last control we are going to look at in this section is the titled pane and what
this is as the name suggests a titled pane with a pane and a title now
the name of this class ends with pane but it's not actually a layout
it is actually a control so let's add 1 to our group and see what it looks like and
will give it a title and add a label to it just so we can really get a feel for
what it looks like so come down here and start typing....
....
....within that
will actually put a label as well so.....
...ok so lets run that...and you can see titled pane their we can open and close it as you can see
their and that is one of the features of Titled pane in that we can actually
click it then you can open and close it so that you can actually hide the
content which can be very useful depending on the application you're
creating and once you hide it all the contents are hidden other than the title and
you can expand that out so you probably asking now ok looks good but where
will we actually use this well we can use this alone as you see now we can
actually add to it and accordion control now what an accordion control is is a group
of tiled panes and only one pane is allowed to be open at a time so that is probably
something that you would use an application so lets add two more titled
panes and put them in an a accordion so you can see what it looks like so close that down close the run window
so what we actually do is we actually put it put it within an accordion so
so come down here and type....
.....
...so thats
our accordion and because we are doing panes we are gonna put...and lets take our titled pane
paste that in there and we're going to remove the grid pane.rowcolumn index
because obviously we've done that in the accordion now that is the first one and lets add a couple more as well
just to see what multiple ones look like.....
....
....and now if we run that have a bit of a look at it and
you can see we've got three of them and we can open only one at a time so its sort of
closes the others automatically so that can be really good way to actually add additional
content on the one screen and only allow the user to go into one at a time to
do whatever processing you want done for that that section for that individual titled pane
and unfortunately there is an limitation there is no currently no way to set the orientation
of an accordion to horizontal you can do it in code by rotating the accordion and we
may look at this in the later lectures so its a little bit of limitation their and again
probably a way around it or we can do it in code by rotating it once it's
actually on the screen but we might look at that a little bit later anyway and one
of the things you probably noticed when we ran it for the
first ill run it again all of them are closed by default and probably
handy to actually expand one by default when the UI first opens so you can sort
of a default pane for the user to see what's in there so to do that
what we need to do is we need to assign an ID to the pane that we want extended and then
have the accordions expanded pane property set to that ID so lets
do that and see what that looks like so we will just expand the third one so
if we are going to be expanding this one we put and id to that so...
and will call the ID tp3....so you will assign and id
to the one that you want and you come up here into the accordion and we put
expanded....
....
...so now if we do that we should find titled pane 3 is open by default when
we ran the application you can see titled three is now open on the screen so that's it that's all the
controls to look at in this section but later on you will see a
few more controls in action thing is that JavaFX offers a wide variety of control
that we can use when building our UI and obviously we've demoed quite a few
controls and touched on some of their properties in this area now do
remember that whenever you are actually working with the control check the
controls documentation because that is usually the best place to find now what is and
isn't possible
there is you know what functionality they've got in other words it's just a good first pit stop to go to
figure out whether there's something in this going to be useful for your application ok
so now we've actually seen how we can build a UI but obviously that's only half
the story we have to handle this user interaction I talked very briefly in a
previously video about events so in other words what happens after we click the
button when we are willing to get the computer to actually do something and
process that command or process the input that the users has type in
etc
we are gonna cover events and threading in the next section look forward to seeing you their cheers
for now