From the posted example, you're looking for a collapsible component.
You could spend the time making your own, things to look out for are the layout manager that the component resides in, if it does not honour the preferred size of the components, it won't work (ie BorderLayout
would not be a good choice to host this type of component in)
Personally, I use the JXCollapsiblePane
from the SwingX
libraries, normally in combination with a VerticalLayout
from the same library.