Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

Tag Archive for ‘Struts’

BoxLayout – Learning Glue & Strut

Java Swing Glue and Strut Example

Here, we will create two examples. One on the left, which makes use of Glue component and the one on the right uses the struts. In both the examples, we have three JPanels with BoxLayout. Two JPanels use Vertical BoxLayout and one JPanel in the Frame’s top uses horizontal BoxLayout. The JPanel contents are below:

1) Right Panel: Button1, Button2, Button3
2) Left Panel: Button7, Button8, Button9
3) Top Panel: Button4, Button5, Button6

With these two examples, we can study how the Struts and Glues behave when the containing container resizes. Note, to study the resizing of Glues and Struts, we will use the edges of the BorderLayout.

Continue Reading →