public class ViewportLayout extends Object implements LayoutManager, Serializable
JViewport的默认布局管理器。
ViewportLayout定义了一个应用于大多数应用程序的布局策略。
视口使其视图与视口大小相同,但不会使视图小于其最小尺寸。
随着视口的增长,视图被保持为底部对齐,直到整个视图可见,随后视图被保持在最上方。
警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,支持所有JavaBeans的长期存储已经添加到java.beans包中。 请参阅XMLEncoder 。
| Constructor and Description |
|---|
ViewportLayout() |
| Modifier and Type | Method and Description |
|---|---|
void |
addLayoutComponent(String name, Component c)
将指定的组件添加到布局。
|
void |
layoutContainer(Container parent)
当指定的容器需要布置时,由AWT调用。
|
Dimension |
minimumLayoutSize(Container parent)
返回布局指定目标容器中包含的组件所需的最小尺寸。
|
Dimension |
preferredLayoutSize(Container parent)
给定指定目标容器中的组件,返回此布局的首选尺寸。
|
void |
removeLayoutComponent(Component c)
从布局中删除指定的组件。
|
public void addLayoutComponent(String name, Component c)
addLayoutComponent在界面
LayoutManager
name -
name的名称
c - 要添加的组件
public void removeLayoutComponent(Component c)
removeLayoutComponent在接口
LayoutManager
c - 要删除的组件
public Dimension preferredLayoutSize(Container parent)
preferredLayoutSize在界面
LayoutManager
parent - 需要布局的组件
Dimension对象
minimumLayoutSize(java.awt.Container)
public Dimension minimumLayoutSize(Container parent)
minimumLayoutSize在接口
LayoutManager
parent - 需要布局的组件
Dimension最小尺寸的
Dimension对象
preferredLayoutSize(java.awt.Container)
public void layoutContainer(Container parent)
layoutContainer在接口
LayoutManager
parent - 容器布置
AWTError - 如果目标不是指定给
BoxLayout构造函数的容器
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.