HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML
 

"Layout Managers"
Vol. 3, Issue 3, p. 27

	

Listing 1
 
Panel  p  = new Panel(); 
Button  b1 = new Button( “Button1” ); 
Button  b2 = new Button( “Button2” ); 
Button  b3 = new Button( “Button3” ); 
GridLayout myLayout = new GridLayout( 3,1 ); // First, create an instance of the  
// LayoutManager . In this example we use  
// GridLayout 
p.setLayout( myLayout );     // Next, tell the Container to use the  
// LayoutManager 
p.add( b1 ); 
p.add( b2 ); 
p.add( b3 );  // Finally, add the Components. When the Components get added to the  
// Container, the LayoutManager determines where they will be positioned on  
// the screen. In this case, the Panel is divided into three rows and one column,  
// each of which will contain one Button.
 
      
 

All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.