javaAPI文档翻译之Java.awt.BorderLayout

Java.lang.Object

Java.awt.BorderLayout


Public class BorderLayout

Extends Object

ImplementsLayoutManaget2,Serializable


A border layout laysout a container, arranging and resizing its components to fit in five regions:north, south, east, west, and center. Each region may contain no more than onecomponent, and is identified by a corresponding constant: NORTHSOUTHEASTWEST, and CENTER. When adding a componentto a container with a border layout, use one of these five constants, forexample:

边框布局展示了一个容器,安排和调整其组件以满足在五个区域:北,南,东,西,和中心。每个区域可以包含不超过一个组件,并且每个区域有相应的常量定义:NORTHSOUTHEASTWEST,CENTER.在将容器组件添加到边框布局时,适用这五个组件的其中之一,比如:

    Panel p =new Panel();

   p.setLayout(new BorderLayout());

    p.add(newButton("Okay"), BorderLayout.SOUTH);

Asa convenience, BorderLayout interprets the absence ofa string specification the same as the constantCENTER:

为了方便,边框布局把缺乏字符串规范解释为常量CENTER

    Panel p2 =new Panel();

   p2.setLayout(new BorderLayout());

    p2.add(newTextArea());  // Same as p.add(newTextArea(), BorderLayout.CENTER);

In addition, BorderLayout supports therelative positioningconstants, PAGE_START, PAGE_END, LINE_START, andLINE_END. In acontainer whose ComponentOrientation is setto ComponentOrientation.LEFT_TO_RIGHT, these constants map to NORTH, SOUTH, WEST,and EAST, respectively.

除此之外,边框布局支持相对定位常量,PAGE_START,PAGE_END,LINE_START,andLINE_END。

在ComponentOrientation设置为ComponentOrientation的容器。LEFT_TO_RIGHT,这些常数分别映射到北、南、西、东。

For compatibility withprevious releases, BorderLayout alsoincludes the relative positioning constantsBEFORE_FIRST_LINE, AFTER_LAST_LINE, BEFORE_LINE_BEGINS and AFTER_LINE_ENDS.These are equivalenttoPAGE_START, PAGE_END, LINE_START and LINE_END respectively.For consistency with the relative positioning constants used by othercomponents, the latter constants are preferred.

为了与以前版本的兼容性,边界布局还包括相对定位常数BEFORE_FIRST_LINE,AFTER_LAST_LINE,BEFORE_LINE_BEGINS和AFTER_LINE_ENDS。

这些分别等同toPAGE_START,PAGE_END,LINE_START和LINE_END。

为了符合由其他组件使用相对定位常数,后者常数是首选。

Mixing both absoluteand relative positioning constants can lead to unpredictable results. If youuse both types, the relative constants will take precedence. For example, ifyou add components using both the NORTH and PAGE_START constants in a container whoseorientation is LEFT_TO_RIGHT, only the PAGE_START will be layedout.

混合绝对和相对定位常数可以导致不可预知的结果。

如果你使用这两种类型,相对常数优先。例如,如果你在定位为LEFT_TO_RIGHT的容器中使用 NORTH还有 PAGE_START常量,那么只有PAGE_START会被布局。

NOTE: Currently (inthe Java 2 platform v1.2), BorderLayout doesnot support vertical orientations. The isVertical setting on the container's ComponentOrientation is not respected.

注意:目前(在Java2平台v1.2),边界管理器不支持垂直方向。该isVertical设置在容器的组件方向不受推崇。

The components arelaid out according to their preferred sizes and the constraints of thecontainer's size. The NORTH and SOUTH componentsmay be stretched horizontally; the EAST and WEST componentsmay be stretched vertically; the CENTER component may stretch bothhorizontally and vertically to fill any space left over.

组件根据他们首选的大小和容器大小约束来布局。NORTH SOUTH组件可以被水平拉伸,EAST WEST组件可以被垂直拉伸;CENTER组件可以横向和纵向拉伸填充留下任何空间。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值