Yes.
Here is how to set the layout manager for our JFrame
:
import java.awt.*; . . . public class ButtonDemo extends JFrame { Button bChange; ButtonDemo() { bChange = new Button("Click Me!"); // choose the layout manager getContentPane().setLayout( new FlowLayout() ); getContentPane().add( bChange ); } public static void main ( String[] args ) { ButtonDemo frm = new ButtonDemo(); . . . . . } }
The layout manager is set using the setLayout()
method of the content pane.