public class BasicScrollPaneUI extends ScrollPaneUI implements ScrollPaneConstants
Modifier and Type | Class and Description |
---|---|
class |
BasicScrollPaneUI.HSBChangeListener
水平滚动条监听器。
|
protected class |
BasicScrollPaneUI.MouseWheelHandler
MouseWheelHandler是一个实现MouseWheelListener接口的内部类。
|
class |
BasicScrollPaneUI.PropertyChangeHandler |
class |
BasicScrollPaneUI.ViewportChangeHandler
监听器用于视口事件。
|
class |
BasicScrollPaneUI.VSBChangeListener
垂直卷轴侦听器。
|
Modifier and Type | Field and Description |
---|---|
protected ChangeListener |
hsbChangeListener |
protected JScrollPane |
scrollpane |
protected PropertyChangeListener |
spPropertyChangeListener |
protected ChangeListener |
viewportChangeListener |
protected ChangeListener |
vsbChangeListener |
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 |
---|
BasicScrollPaneUI() |
contains, getAccessibleChild, getAccessibleChildrenCount, getMinimumSize, getPreferredSize, update
protected JScrollPane scrollpane
protected ChangeListener vsbChangeListener
protected ChangeListener hsbChangeListener
protected ChangeListener viewportChangeListener
protected PropertyChangeListener spPropertyChangeListener
public static ComponentUI createUI(JComponent x)
public void paint(Graphics g, JComponent c)
ComponentUI
复制
ComponentUI.update
指定组件正在被绘制时的方法。
子类应该覆盖此方法,并使用指定的Graphics
对象来呈现Graphics
的内容。
paint
在
ComponentUI
类
g
- 要绘画的
Graphics
上下文
c
- 正在涂漆的部件;
这个参数经常被忽略,但如果UI对象是无状态的并且被多个组件共享,则可能会被使用
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
public Dimension getMaximumSize(JComponent c)
ComponentUI
null
,则最大大小将由组件的布局管理器计算(这是安装了特定布局管理器的任何组件的首选方法)。
此方法的默认实现将调用getPreferredSize
并返回该值。
getMaximumSize
在
ComponentUI
c
- 查询最大大小的组件;
这个参数经常被忽略,但如果UI对象是无状态的并且被多个组件共享,则可能会被使用
JComponent.getMaximumSize()
,
LayoutManager2.maximumLayoutSize(java.awt.Container)
protected void installDefaults(JScrollPane scrollpane)
protected void installListeners(JScrollPane c)
protected void installKeyboardActions(JScrollPane c)
public void installUI(JComponent x)
ComponentUI
ComponentUI
实例作为指定组件上的UI委托时,将调用此方法。
该方法应该完全配置组件的外观,包括以下内容:
LayoutManager
上安装LayoutManager。 PropertyChangeListener
上创建/安装PropertyChangeListener,以便适当地检测和响应组件属性更改。 installUI
在
ComponentUI
x
- 正在安装此UI代理的组件
ComponentUI.uninstallUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
protected void uninstallDefaults(JScrollPane c)
protected void uninstallListeners(JComponent c)
protected void uninstallKeyboardActions(JScrollPane c)
public void uninstallUI(JComponent c)
ComponentUI
installUI
上完成的installUI
。
当这个UIComponent
实例作为指定组件的UI委托被删除时,将调用此方法。
该方法应该撤消在installUI中执行的installUI
,小心使JComponent
实例处于干净状态(无外部监听器,外观特定属性对象等)。
这应该包括以下内容:
uninstallUI
在
ComponentUI
c
- 从中删除此UI代理的组件;
这个参数经常被忽略,但如果UI对象是无状态的并且被多个组件共享,则可能会被使用
ComponentUI.installUI(javax.swing.JComponent)
,
JComponent.updateUI()
protected void syncScrollPaneWithViewport()
public int getBaseline(JComponent c, int width, int height)
getBaseline
在
ComponentUI
c
-
JComponent
正在请求基准
width
- 获取基准的宽度
height
- 获取基准的高度
NullPointerException
- 如果
c
是
null
IllegalArgumentException
- 如果宽度或高度<0
JComponent.getBaseline(int, int)
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
getBaselineResizeBehavior
在
ComponentUI
c
-
JComponent
以返回基线调整大小行为
NullPointerException
- 如果
c
是
null
JComponent.getBaseline(int, int)
protected ChangeListener createViewportChangeListener()
protected ChangeListener createHSBChangeListener()
protected ChangeListener createVSBChangeListener()
protected MouseWheelListener createMouseWheelListener()
installUI(javax.swing.JComponent)
, BasicScrollPaneUI.MouseWheelHandler
protected void updateScrollBarDisplayPolicy(PropertyChangeEvent e)
protected void updateViewport(PropertyChangeEvent e)
protected void updateRowHeader(PropertyChangeEvent e)
protected void updateColumnHeader(PropertyChangeEvent e)
protected PropertyChangeListener createPropertyChangeListener()
class MyScrollPaneUI extends BasicScrollPaneUI {
protected PropertyChangeListener createPropertyChangeListener() {
return new MyPropertyChangeListener();
}
public class MyPropertyChangeListener extends PropertyChangeListener {
public void propertyChange(PropertyChangeEvent e) {
if (e.getPropertyName().equals("viewport")) {
// do some extra work when the viewport changes
}
super.propertyChange(e);
}
}
}
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.