What is the process of setting the layout manager?

Submitted by: Administrator
The layout managers uses Jpanels and content panes to initializes the object that is to be used with the FlowLayout by default and it can be changed by defining a different layout. Content panes uses border layout by default and it uses appropriate tools that can be used to code the appropriate object that has to be used. The panel layout manger can be setup by using the Jpanel constructor and it can be shown by an example given as:

JPanel panel = new JPanel(new BorderLayout());

The setLayout method is used to set the layout manager after the container is being created.

Container contentPane = frame.getContentPane();
contentPane.setLayout(new FlowLayout());

The container's layout property can be changed to NULL to allow the absolute positioning to take place where the specification is given in the form of size and positon of each component that is used inside the container.
Submitted by: Administrator

Read Online Swing AWT Job Interview Questions And Answers