public class ScrollPaneLayout extends Object implements LayoutManager, ScrollPaneConstants, Serializable
JScrollPane
布局管理器。
JScrollPaneLayout
负责九个部分组成:一个视图中,两个滚动条,行标题,列标题,和四“角”成分。
警告:序列化该类的对象与以后的Swing版本不兼容。当前的序列化支持适用于短期贮藏或RMI运行相同Swing版本的应用程序之间。为1.4,为所有JavaBeans™长期存储的支持已被添加到java.beans
包。请看XMLEncoder
。
JScrollPane
,
JViewport
Modifier and Type | Class and Description |
---|---|
static class |
ScrollPaneLayout.UIResource
ScrollPaneLayout 版本的UI资源。
|
Modifier and Type | Field and Description |
---|---|
protected JViewport |
colHead
列头子。
|
protected JScrollBar |
hsb
水平滚动条的滚动窗格的孩子。
|
protected int |
hsbPolicy
在水平滚动条的显示策略。
|
protected Component |
lowerLeft
该组件显示在左下角。
|
protected Component |
lowerRight
组件显示在右下角。
|
protected JViewport |
rowHead
行头子。
|
protected Component |
upperLeft
该组件显示在左上角。
|
protected Component |
upperRight
组件显示在右上角。
|
protected JViewport |
viewport
的滚动窗格的视口的孩子。
|
protected JScrollBar |
vsb
垂直滚动条的滚动窗格的孩子。
|
protected int |
vsbPolicy
对于垂直滚动条的显示策略。
|
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
Constructor and Description |
---|
ScrollPaneLayout() |
Modifier and Type | Method and Description |
---|---|
void |
addLayoutComponent(String s, Component c)
将指定的组件添加到布局中。
|
protected Component |
addSingletonComponent(Component oldC, Component newC)
移除现有组件。
|
JViewport |
getColumnHeader()
返回的列标头的
JViewport 对象。
|
Component |
getCorner(String key)
返回指定角的
Component 。
|
JScrollBar |
getHorizontalScrollBar()
返回
JScrollBar 对象处理水平滚动。
|
int |
getHorizontalScrollBarPolicy()
收益水平滚动条显示策略。
|
JViewport |
getRowHeader()
返回的行标头的
JViewport 对象。
|
JScrollBar |
getVerticalScrollBar()
返回
JScrollBar 对象处理垂直滚动。
|
int |
getVerticalScrollBarPolicy()
返回垂直滚动条显示策略。
|
JViewport |
getViewport()
返回
JViewport 对象显示可滚动的内容。
|
Rectangle |
getViewportBorderBounds(JScrollPane scrollpane)
过时的。
作为JDK版本swing1.1取代
JScrollPane.getViewportBorderBounds() 。
|
void |
layoutContainer(Container parent)
制定滚动窗格。
|
Dimension |
minimumLayoutSize(Container parent)
一个
ScrollPane 最小尺寸的插图加视窗的最小尺寸的大小,再加上滚动窗格的viewportborder插图,加上可见头的最小尺寸,加上最小尺寸的滚动条的displaypolicy不是永远。
|
Dimension |
preferredLayoutSize(Container parent)
一个
ScrollPane 首选大小是间隔尺寸,加上视口的首选大小,加上可见头首选大小,加上首选大小的滚动条,会出现在当前视图和当前的滚动条displaypolicies。
|
void |
removeLayoutComponent(Component c)
从布局中移除指定的组件。
|
void |
setHorizontalScrollBarPolicy(int x)
设置水平滚动条显示策略。
|
void |
setVerticalScrollBarPolicy(int x)
设置垂直滚动条显示策略。
|
void |
syncWithScrollPane(JScrollPane sp)
调用此方法后,scrollpanelayout设置为一个
JScrollPane 的布局管理器。
|
protected JViewport viewport
JViewport
。
protected JScrollBar vsb
JScrollBar
。
protected JScrollBar hsb
JScrollBar
。
protected JViewport rowHead
null
。
protected JViewport colHead
null
。
protected Component lowerLeft
null
。
protected Component lowerRight
null
。
protected Component upperLeft
null
。
protected Component upperRight
null
。
protected int vsbPolicy
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED
。
这场已经过时了,请用JScrollPane
场代替。
protected int hsbPolicy
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
。
这场已经过时了,请用JScrollPane
场代替。
public void syncWithScrollPane(JScrollPane sp)
JScrollPane
的布局管理器。它初始化所有通常由
addLayoutComponent
领域内。例如:
scrollpanelayout mysplayout =新scrollpanellayout() {公共无效layoutcontainer(容器P){超级layoutcontainer(P);在这里做一些额外的工作…}};滚动窗格setLayout(mysplayout):
protected Component addSingletonComponent(Component oldC, Component newC)
此方法返回newC
。如果oldC
不等于newC
,non-null
,它将从其母公司删除。
oldC
-
Component
取代
newC
-
Component
添加
newC
public void addLayoutComponent(String s, Component c)
addLayoutComponent
接口
LayoutManager
s
的组标识符
c
的组件被添加
IllegalArgumentException
-如果
s
是无效的关键
public void removeLayoutComponent(Component c)
removeLayoutComponent
接口
LayoutManager
c
-删除组件
public int getVerticalScrollBarPolicy()
setVerticalScrollBarPolicy(int)
public void setVerticalScrollBarPolicy(int x)
JScrollPane
版。它只存在与摆动1.0.2向后兼容性(早)这类版本。
x
-一个整数,显示政策
IllegalArgumentException
-如果
x
是无效的垂直滚动条政策,如上述
public int getHorizontalScrollBarPolicy()
setHorizontalScrollBarPolicy(int)
public void setHorizontalScrollBarPolicy(int x)
JScrollPane
版。它只存在与摆动1.0.2向后兼容性(早)这类版本。
x
- int给显示策略
IllegalArgumentException
-如果
x
不是有效的水平滚动条政策,如上述
public JViewport getViewport()
JViewport
对象显示可滚动的内容。
JViewport
对象显示可滚动的内容
JScrollPane.getViewport()
public JScrollBar getHorizontalScrollBar()
JScrollBar
对象处理水平滚动。
JScrollBar
对象的处理水平滚动
JScrollPane.getHorizontalScrollBar()
public JScrollBar getVerticalScrollBar()
JScrollBar
对象处理垂直滚动。
JScrollBar
对象处理垂直滚动
JScrollPane.getVerticalScrollBar()
public JViewport getRowHeader()
JViewport
对象,行标题。
JViewport
对象
JScrollPane.getRowHeader()
public JViewport getColumnHeader()
JViewport
对象。
JViewport
对象
JScrollPane.getColumnHeader()
public Component getCorner(String key)
Component
。
key
-
String
指定角
Component
,定义在
ScrollPaneConstants
;如果
key
不是四个角,
null
返回
JScrollPane.getCorner(java.lang.String)
public Dimension preferredLayoutSize(Container parent)
ScrollPane
首选大小是间隔尺寸,加上视口的首选大小,加上可见头首选大小,加上首选大小的滚动条,会出现在当前视图和当前的滚动条displaypolicies。
请注意,rowheader计算为首选的宽度和colheader计算为首选大小部分。
preferredLayoutSize
接口
LayoutManager
parent
-
Container
将放
Dimension
指定视口的首选大小和任何滚动条
ViewportLayout
,
LayoutManager
public Dimension minimumLayoutSize(Container parent)
ScrollPane
最小尺寸的插图加视窗的最小尺寸的大小,再加上滚动窗格的viewportborder插图,加上可见头的最小尺寸,加上最小尺寸的滚动条的displaypolicy不是永远。
minimumLayoutSize
接口
LayoutManager
parent
-
Container
将放
Dimension
对象指定的最小尺寸
LayoutManager.preferredLayoutSize(java.awt.Container)
public void layoutContainer(Container parent)
displayPolicy
总是很像对待与尊重其尺寸行标题是可见的。null
viewportBorder
滚动窗格,然后分配空间。layoutContainer
接口
LayoutManager
parent
-
Container
奠定了
@Deprecated public Rectangle getViewportBorderBounds(JScrollPane scrollpane)
JScrollPane.getViewportBorderBounds()
。
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.