码迷,mamicode.com
首页 > 其他好文 > 详细

每个容器都有一个布局管理器

时间:2018-08-05 14:55:05      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:bsp   ted   java   顺序   lse   决定   ack   获得   style   

布局管理器(LayoutManager):每个容器都有一个布局管理器,当容器需要对某个组件进行定位或判断其大小、尺寸时,就会调用其对应的布局管理器。

使用布局管理器可以实现跨平台的特性,并且获得动态的布局效果。

布局管理器负责管理组件的排列顺序、大小和位置。

不同的布局管理器使用不同的布局策略,容器可以通过选择不同的布局管理器来决定如何布局。

 

 1 package TomAwt;
 2 
 3 
 4 import java.applet.Applet;
 5 import java.awt.*;
 6 public class TomAwt_17 extends Applet{
 7     private TextArea textArea1,textArea2;
 8     public void init()
 9     {
10         //creating 2 10*20 TextAreas
11         textArea1=new TextArea("Read-only Text!",10,20);
12         textArea2=new TextArea(10,20);
13         //set textArea1 read-only
14         textArea1.setEditable(false);
15         add(textArea1);
16         add(textArea2);
17     }
18 }

 

每个容器都有一个布局管理器

标签:bsp   ted   java   顺序   lse   决定   ack   获得   style   

原文地址:https://www.cnblogs.com/borter/p/9425441.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!