Hey all. I'm making a program which uses many buttons and a textfield. I need help and some explaining on how to organise components within a panel.
For example,using

mainPanel.add(BorderLayout.WEST,buttonBox2 );

All components (the buttons within the background panel,the buttons within buttonbox1/2 and the display field) are "sticked". How can i add a gap between .NORTH and .CENTER?
i have tried :


but nope.
Also,The buttons in buttonboxes (box class) are Y_AXIS aligned but they also have no gap.
i tried buttonBox.createGlue(); but also nothing.
Ive been reading and messing around with gridLayouts,boxLayouts,borderFactory for a good 3 hours now...
Anyway,apart from my program,any small "guide" on how to easily play with components arrangement would be awesome.Thanks!

mainPanel.setLayout(new BorderLayout(10, 10));
mainPanel.add(display, BorderLayout.NORTH);
mainPanel.add(background, BorderLayout.CENTER);