What is the purpose of and the logic behind breaking methods up into sections with opening and closing curly braces " { } "??
One thing I notice is that when creating a DockPanel you appear to "re-use" generic widget names as shown below. I notice that if I leave out the "curly brace sectioning" then the compiler (or eclipse) starts complaining about the name being redeclared ... can you give a quick review of the use and logic behind this?
- Code: Select all
{
HorizontalPanel horizontalPanel = new HorizontalPanel();
horizontalPanel.setSize("100%", "60");
dockPanel.add(horizontalPanel, DockPanel.NORTH);
}
{
HorizontalPanel horizontalPanel = new HorizontalPanel();
horizontalPanel .setSize("100%", "40");
dockPanel.add(horizontalPanel, DockPanel.SOUTH);
}
Thanks!