If you are having trouble using Layout Managers the secret is to layer your application. Use Panels with different Layouts to position other panels or widgets where you want them. The calculator below uses this technique to get the buttons sized and placed where they are wanted. To see the panes better, download the source code and run this in an applet viewer. In the applet viewer, change the size of the window and you will see the top level panels separate. This will make it easier to see how the panels are laid out. By the way, Mac OSX buttons are too big see the calculator correctly. For Mac users, download the program and run in the Applet Viewer, where you can change the size of the window.

Calculator source code

return to the Java Help Page.