Ebeworld’s Weblog

Trying to create

Swing Layouts

Explain layout managers?

Layout managers are used for arranging GUI components in windows. The standard layout managers are:

• FlowLayout: Default layout for Applet and Panel. Lays out components from left to right, starting new rows if necessary.

• BorderLayout: Default layout for Frame and Dialog. Lays out components in north, south, east, west and

center. All extra space is placed on the center.

• CardLayout: stack of same size components arranged inside each other. Only one is visible at any time. Used in TABs.

• GridLayout: Makes a bunch of components equal in size and displays them in the requested number of rows

and columns.

• GridBagLayout: Most complicated but the most flexible. It aligns components by placing them within a grid of cells, allowing some components to span more than one cell. The rows in the grid aren’t necessarily all the same height, similarly, grid columns can have different widths as well.

BoxLayout: is a full-featured version of FlowLayout. It stacks the components on top of each other or places  them in a row.

October 14, 2008 - Posted by ebeworld | Interview Questions, Java | , | No Comments Yet

No comments yet.

Leave a comment