17
+ GridBagLayout Quick Start Albert Guo [email protected]

GridBagLayout Quick Start

Embed Size (px)

Citation preview

Page 1: GridBagLayout Quick Start

+

GridBagLayout Quick StartAlbert [email protected]

Page 2: GridBagLayout Quick Start

+What is GridBagLayout ?

GridBagLayout is the most complex and most flexible of the layout managers.

With GridLayout, elements are arranged in a rectangular grid, and each element in the container is sized identically (where possible).

With GridBagLayout, elements can have different sizes and can occupy multiple rows or columns

Note The maximum capacity of a screen using GridBagLayout is

512 rows by 512 columns. This is specified by the protected MAXGRIDSIZE constant of the layout manager

2

Page 3: GridBagLayout Quick Start

+What is GridBagLayout ?

3

Page 4: GridBagLayout Quick Start

+GridBagConstraints Class

The magic of the layout manager is strictly controlled by the different GridBagConstraints objects passed in for each component added to the container.

Each specifies how to display a specific component. Unlike most other layout managers, which have a built-in idea about what to do with their display, the GridBagLayout is a blank slate.

The constraints attached to the components tell the layout manager how to build its display.

4

Page 5: GridBagLayout Quick Start

+ 5

Page 6: GridBagLayout Quick Start

+Create a Add Job Duty Frame

btnPanel includes save button and reset button

6

0

1

2

3

4

0 1 2 3

Page 7: GridBagLayout Quick Start

+GridBagLayout & GridBagConstraints

7

Page 8: GridBagLayout Quick Start

+Class Diagram

8

Page 9: GridBagLayout Quick Start

+Sequence Diagram

9

Page 10: GridBagLayout Quick Start

+ 10

Page 11: GridBagLayout Quick Start

+ 11

Page 12: GridBagLayout Quick Start

+ 12

Page 13: GridBagLayout Quick Start

+ 13

Page 14: GridBagLayout Quick Start

+ 14

Page 15: GridBagLayout Quick Start

+ 15

Page 16: GridBagLayout Quick Start

+ 16

Page 17: GridBagLayout Quick Start

+Demo

17

0 1 2 3

0

1

2

3

4