public class BasicProgressBarUI extends ProgressBarUI
Modifier and Type | Class and Description |
---|---|
class |
BasicProgressBarUI.ChangeHandler
这个类应该被视为一个“受保护的”内部类。
|
Modifier and Type | Field and Description |
---|---|
protected Rectangle |
boxRect
用于保存位置和弹跳箱尺寸(由getbox)要画。
|
protected ChangeListener |
changeListener |
protected JProgressBar |
progressBar |
Constructor and Description |
---|
BasicProgressBarUI() |
Modifier and Type | Method and Description |
---|---|
static ComponentUI |
createUI(JComponent x) |
protected int |
getAmountFull(Insets b, int width, int height)
这就决定了基于模型所收集的百分比来填充进度条的数量。
|
protected int |
getAnimationIndex()
获取当前动画帧的索引。
|
int |
getBaseline(JComponent c, int width, int height)
返回基线。
|
Component.BaselineResizeBehavior |
getBaselineResizeBehavior(JComponent c)
返回一个枚举指示组件的尺寸的变化的基线。
|
protected Rectangle |
getBox(Rectangle r)
商店的位置和大小的弹跳框会画目前动画指数
r 返回
r 。
|
protected int |
getBoxLength(int availableLength, int otherDimension)
返回要被绘制的“弹跳箱”的长度。
|
protected int |
getCellLength()
返回进度条中的每一个单元格的每个单元格的宽度(如果是水平的)或高度(如果垂直)。
|
protected int |
getCellSpacing()
返回进度条中的每个单元格/单位之间的间距。
|
protected int |
getFrameCount()
返回的一个不确定的jprogessbar用完整的动画循环帧的数量。
|
Dimension |
getMaximumSize(JComponent c)
返回指定组件的最大大小适合的外观和感觉。
|
Dimension |
getMinimumSize(JComponent c)
该组件的最小大小为10。
|
protected Dimension |
getPreferredInnerHorizontal() |
protected Dimension |
getPreferredInnerVertical() |
Dimension |
getPreferredSize(JComponent c)
返回指定组件的首选大小适合的外观和感觉。
|
protected Color |
getSelectionBackground()
“选题背景”是文本的颜色,当它是画在进度条未填充的区域。
|
protected Color |
getSelectionForeground()
“selectionforeground”是文本的颜色,当它是画在一个填充区域的进度条。
|
protected Point |
getStringPlacement(Graphics g, String progressString, int x, int y, int width, int height)
指定进度字符串将被绘制的地方。
|
protected void |
incrementAnimationIndex()
设置当前动画帧的索引,到下一个有效值,导致进度条被重新粉刷。
|
protected void |
installDefaults() |
protected void |
installListeners() |
void |
installUI(JComponent c)
配置指定的组件适当的外观和感觉。
|
void |
paint(Graphics g, JComponent c)
代表们画的一个方法:paintdeterminate或paintindeterminate。
|
protected void |
paintDeterminate(Graphics g, JComponent c)
所有目的的油漆方法,应该做正确的事情几乎所有的线性,确定的进度条。
|
protected void |
paintIndeterminate(Graphics g, JComponent c)
所有目的的油漆方法,应该做正确的事情的所有线性弹跳箱进度条。
|
protected void |
paintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b) |
protected void |
setAnimationIndex(int newValue)
设置为指定的值并要求进度条被重画当前动画帧的索引。
|
protected void |
setCellLength(int cellLen) |
protected void |
setCellSpacing(int cellSpace) |
protected void |
startAnimationTimer()
开始动画线程的创建和初始化它,如果必要的话。
|
protected void |
stopAnimationTimer()
停止动画线程。
|
protected void |
uninstallDefaults() |
protected void |
uninstallListeners()
移除此对象安装的所有侦听器。
|
void |
uninstallUI(JComponent c)
逆转形态,完成指定的组件在
installUI 。
|
contains, getAccessibleChild, getAccessibleChildrenCount, update
protected JProgressBar progressBar
protected ChangeListener changeListener
protected Rectangle boxRect
public static ComponentUI createUI(JComponent x)
public void installUI(JComponent c)
ComponentUI
ComponentUI
实例被安装在指定组件的UI代理。这种方法应该完全配置的组件外观和感觉,包括以下内容:
LayoutManager
组件上的必要。PropertyChangeListener
变化适当。installUI
方法重写,继承类
ComponentUI
c
-组件,UI代理被安装
ComponentUI.uninstallUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
public void uninstallUI(JComponent c)
ComponentUI
installUI
。这个方法被调用时,这个
UIComponent
实例被作为指定组件的UI代理删除。这种方法应该撤消配置进行
installUI
,小心留下的
JComponent
实例在干净的状态(没有多余的听众,外观和感觉的特定属性的对象,等)。这应包括以下几个方面:
uninstallUI
方法重写,继承类
ComponentUI
c
-从这个UI代理被删除的组件;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
ComponentUI.installUI(javax.swing.JComponent)
,
JComponent.updateUI()
protected void installDefaults()
protected void uninstallDefaults()
protected void installListeners()
protected void startAnimationTimer()
stopAnimationTimer()
protected void stopAnimationTimer()
startAnimationTimer()
protected void uninstallListeners()
public int getBaseline(JComponent c, int width, int height)
getBaseline
方法重写,继承类
ComponentUI
c
-
JComponent
基线被要求
width
的宽度得到基线
height
-高度得到基线
null
c
NullPointerException
IllegalArgumentException
如果宽度或高度小于0
JComponent.getBaseline(int, int)
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
getBaselineResizeBehavior
方法重写,继承类
ComponentUI
c
-
JComponent
返回基线调整行为
null
c
NullPointerException
JComponent.getBaseline(int, int)
protected Dimension getPreferredInnerHorizontal()
protected Dimension getPreferredInnerVertical()
protected Color getSelectionForeground()
protected Color getSelectionBackground()
protected int getCellLength()
setCellLength(int)
,
JProgressBar.isStringPainted()
protected void setCellLength(int cellLen)
protected int getCellSpacing()
setCellSpacing(int)
,
JProgressBar.isStringPainted()
protected void setCellSpacing(int cellSpace)
protected int getAmountFull(Insets b, int width, int height)
public void paint(Graphics g, JComponent c)
paint
方法重写,继承类
ComponentUI
g
-其中
Graphics
背景画
c
-正在绘制的构件;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
protected Rectangle getBox(Rectangle r)
r
返回
r
。子类添加到绘画中
paintIndeterminate
这类的执行进行在弹跳框勾出一个轮廓,例如,可以使用此方法得到的弹箱,刚刚粉刷过的位置。通过重写此方法,你的弹跳框的大小和位置的完全控制,而无需重新实现
paintIndeterminate
。
r
-矩形实例进行修改;可以
null
null
如果没有盒子应该画;否则,返回传入的矩形(如果非空)或一个新的矩形
setAnimationIndex(int)
protected int getBoxLength(int availableLength, int otherDimension)
paintIndeterminate
默认实现调用得到的宽度(如果进度条水平)或高度(垂直)的盒子。例如:
boxRect.width = getBoxLength(componentInnards.width, componentInnards.height);
availableLength
-可弹跳的盒子在空间移动的量;一个水平进度条,例如,这应该是进度条的内侧宽度(构件宽度减去边界)
otherDimension
-水平进度条,这应该是进度条的内部高度;该值可能用来限制或确定的返回值
availableLength
SwingUtilities.calculateInnerArea(javax.swing.JComponent, java.awt.Rectangle)
protected void paintIndeterminate(Graphics g, JComponent c)
paintDeterminate(java.awt.Graphics, javax.swing.JComponent)
protected void paintDeterminate(Graphics g, JComponent c)
paintIndeterminate(java.awt.Graphics, javax.swing.JComponent)
protected void paintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b)
protected Point getStringPlacement(Graphics g, String progressString, int x, int y, int width, int height)
public Dimension getPreferredSize(JComponent c)
ComponentUI
null
返回,首选大小将由组件的布局管理器的计算(这是与一个特定的布局管理器安装任何组件的首选方法)。此方法的默认实现将返回
null
。
getPreferredSize
方法重写,继承类
ComponentUI
c
优先度的被查询的成分;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
JComponent.getPreferredSize()
,
LayoutManager.preferredLayoutSize(java.awt.Container)
public Dimension getMinimumSize(JComponent c)
getMinimumSize
方法重写,继承类
ComponentUI
c
最小尺寸的是被查询的成分;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
Dimension
对象或
null
JComponent.getMinimumSize()
,
LayoutManager.minimumLayoutSize(java.awt.Container)
,
ComponentUI.getPreferredSize(javax.swing.JComponent)
public Dimension getMaximumSize(JComponent c)
ComponentUI
null
返回,最大规模将由组件的布局管理器的计算(这是与一个特定的布局管理器安装任何组件的首选方法)。此方法的默认实现调用
getPreferredSize
和返回值。
getMaximumSize
方法重写,继承类
ComponentUI
c
-其最大尺寸被查询的成分;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
Dimension
对象或
null
JComponent.getMaximumSize()
,
LayoutManager2.maximumLayoutSize(java.awt.Container)
protected int getAnimationIndex()
protected final int getFrameCount()
protected void setAnimationIndex(int newValue)
repaint
方法被调用的方法。
newValue
-新动画指数;没有检查是对其价值进行
incrementAnimationIndex()
protected void incrementAnimationIndex()
setAnimationIndex(int)
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.