Basic HTML version of Foils prepared 18 May 97

Foil 58 Hierarchical use of LayoutManagers

From Java Tutorial - Spring 1997 Part 3:Graphics and the Abstract Windowing Toolkit Peking Tutorial, Web Certificate -- Spring-Summer 1997. by Nancy J. McCracken,Geoffrey C. Fox


1 Layout's can be made very sophisticated using an hierarchical approach
2 setLayout(new GridLayout(1,3,10,5));
  • // Number of cells in y, Number in x, Horizontal gap, Vertical Gap
3 subpanel1 = new MysubpanelClass(); // Add arguments to make subpanel1 special
4 subpanel2 = new MysubpanelClass();
5 add(Some Simple Component such as a Button);
6 add(subpanel1);
7 add(subpanel2);
8 . . . . .
9 Class MysubpanelClass extends panel { // has constructor
10 MysubpanelClass() { // that includes another layout such as
11 setLayout(new GridLayout(2,2,5,5); // etc.

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Thu Jan 8 1998