To test all your SwingBuilder views SwingPad is a really nice tool for prototyping. SwingPad is bundled with Griffon distributions as a sample app.
BorderLayout can arrange components in 5 different areas: NORTH,SOUTH,EAST,WEST and CENTER.
In this particular case I'm applying this layout to a given panel:
And this is how it looks:
import java.awt.BorderLayout as BL
import java.awt.Dimension
panel(preferredSize:new Dimension(500,200)){
borderLayout()
/* -- NORTH --- */
textField(id:'title',constraints:BL.NORTH)
/* -- CENTER --- */
scrollPane(constraints:BL.CENTER){
table(id:'messages'){
tableModel(){
propertyColumn(header:'language',propertyName:'language')
propertyColumn(header:'text',propertyName:'text')
}
}
}
/* -- SOUTH --- */
button(
id:'executeButton',
constraints:BL.SOUTH,
)
}
In order to apply a BorderLayout to a given container is to declare the node borderLayout() before adding component nodes.
Finally, component arrangement should be made through the constraints property in each of the added components
button(
id:'executeButton',
constraints:BL.SOUTH,
)
No comments:
Post a Comment