The way that you place components on a form in Java is probably different from any other GUI system youve used. First, its all code; there are no resources that control placement of components. Second, the way components are placed on a form is controlled not by absolute positioning but by a layout manager that decides how the components lie based on the order that you add( ) them. The size, shape, and placement of components will be remarkably different from one layout manager to another. In addition, the layout managers adapt to the dimensions of your applet or application window, so if the window dimension is changed, the size, shape, and placement of the components can change in response.
JApplet, JFrame JWindow, and JDialog can all produce a Container with getContentPane( ) that can contain and display Components. In Container, theres a method called setLayout( ) that allows you to choose a different layout manager. Other classes, such as JPanel, contain and display components directly, so you also set the layout manager directly, without using the content pane.
In this section well explore the various layout managers by placing buttons in them (since thats the simplest thing to do). There wont be any capturing of button events because these examples are just intended to show how the buttons are laid out.