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.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHOZlIYcH3WIXCz5fWQqLjX5PR590jyF7Vm8miII6AJUK5jrXb-tdIS8Zl5pSyM8Kw9my_3PgBqlu6byIRsFhtpPUmjp0OxE5X9zTJVjj2hTROobONT0t2uxqkuGqDbUqZwCCgSqNQ3Iwg/s320/Screen+Shot+2012-02-10+at+1.14.41+AM.png)
In this particular case I'm applying this layout to a given panel:
And this is how it looks:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg23yy7Hhnf1W_XkilxpTPB1ZQx4iA7xJkyrMBzj6YjXb5ZzzCVMZ954vIPluRR94riqCklgpUhEH3jViWXt3O0G2CBNHBLos4d6MWBwpBg3Nk4f38MLwHPTH-dagAxzF8tvp4iJNQw-Rt2/s320/borderlayout.png)
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,
)
}
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg23yy7Hhnf1W_XkilxpTPB1ZQx4iA7xJkyrMBzj6YjXb5ZzzCVMZ954vIPluRR94riqCklgpUhEH3jViWXt3O0G2CBNHBLos4d6MWBwpBg3Nk4f38MLwHPTH-dagAxzF8tvp4iJNQw-Rt2/s320/borderlayout.png)
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