• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Java Programming Problem

Pegun

Golden Member
Hey all, I am having a minor problem. I am creating a program where there are three buttons in the upper left hand corner and now i want three under those. When i create a panel, it makes it so that the three buttons are right next to the first three though. How can i modify my coding to make this possible?

Panel buttonPanel = new Panel(new FlowLayout(FlowLayout.LEFT));
topPanel.add(buttonPanel); //original panel

circle = new Button("Circle");
buttonPanel.add(circle);
roundRec = new Button("Rounded Rectangle");
buttonPanel.add(roundRec);
threeDRec = new Button("3D Rectangle"); //first three buttons
buttonPanel.add(threeDRec);
Panel secondPanel = new Panel(new FlowLayout(FlowLayout.LEFT));
topPanel.add(secondPanel); //second panel
line = new Button("Line");
buttonPanel.add(line);
oval = new Button("Oval");
buttonPanel.add(oval);
square = new Button("Square");
buttonPanel.add(square); //next three buttons
clear = new Button("Clear");
buttonPanel.add(clear);
 
Back
Top