Social Sciences, asked by raghavmummy7881, 1 year ago

Write down a steps to change default layout manager

Answers

Answered by AbsorbingMan
0

Use the JPanel constructors, which accept a LayoutManager:

import java.awt.LayoutManager;

import javax.swing.JPanel;

public class MyPanel extends JPanel {

   public MyPanel() {

       this(true);

   }

   public MyPanel(boolean isDoubleBuffered) {

       super(null, isDoubleBuffered);

   }

   public MyPanel(LayoutManager layout, boolean isDoubleBuffered) {

       super(layout, isDoubleBuffered);

   }

   public MyPanel(LayoutManager layout) {

       this(layout, true);

   }

}

Answered by aqibkincsem
0

Solution: The only containers whose layout managers one should worry for is JPanels and content panes.

By default, content panes have Border Layout. However, one is free to change this default layout.

For any real applications, it is important to change or reset the layout manager and requires appropriate tools rather the manager by hand.

Different methods are used as per the type of changes.

Similar questions