-
Notifications
You must be signed in to change notification settings - Fork 149
Containers
There are container creation functions which basically create JPanel
instances with particular layouts. Here are some examples. Any place that a widget or list of widgets is expected, the widget coercion rules described above apply.
The widgets held by most containers, with the exception of BorderLayout
, are set with the :items
option. As noted above, widget coercion rules apply. In the simplest cases, :items
is just a list os widgets, but the exact format of the option varies with container type. For example, (mig-panel)
takes a sequence of widget/constaint pairs.
A FlowLayout
with some items:
(flow-panel
:align :left
:hgap 20
:items ["Label" (action :handler alert "Button") "Another label"])
A GridLayout
with 2 columns and a titled border:
(grid-panel
:border "Properties"
:columns 2
:items ["Name" (text "Frank")
"Address" (text "123 Main St")])
A BorderLayout
with labels at each position:
(border-panel :hgap 10 :vgap 10 :center "CENTER" :north "NORTH" :south "SOUTH" :east "EAST" :west "WEST")
There's also (mig-panel)
which uses [MigLayout] (http://www.miglayout.com/), (vertical-panel)
, (horizontal-panel)
, (border-panel)
, etc.
The :items
option can also be modified with (config!)
which will have the effect of clearing the container and repopulating it. If your familiar with Swing, you'll appreciate that the irritating details of this operation are taken care of by Seesaw.