What\'s the difference between:
public class Test {
public static void main(String[] args) {
JButton button= new JButton(\"1\");
button.
The purpose is to group components together.
Look at this web page for example. You could imagine a center panel with the question and answers laid out vertically, a right panel containing yet other panels: one for the blog, one for the job announcement, one for the related questions, and finally a south panel for the footer.
The footer panel can be reused in other pages than question pages.
The layout of the page as a whole is easier to understand and implement if you divide it into independant panels.