- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.ProgressBarUI
-
- javax.swing.plaf.basic.BasicProgressBarUI
-
- javax.swing.plaf.synth.SynthProgressBarUI
-
- All Implemented Interfaces:
-
PropertyChangeListener,EventListener,SynthConstants,SynthUI
public class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI, PropertyChangeListener
为JProgressBar提供Synth L&F UI代表。- 从以下版本开始:
- 1.7
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicProgressBarUI
BasicProgressBarUI.ChangeHandler
-
-
Field Summary
-
Fields inherited from class javax.swing.plaf.basic.BasicProgressBarUI
boxRect, changeListener, progressBar
-
Fields inherited from interface javax.swing.plaf.synth.SynthConstants
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED
-
-
构造方法摘要
构造方法 Constructor 描述 SynthProgressBarUI()
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 static ComponentUIcreateUI(JComponent x)为给定的组件创建一个新的UI对象。intgetBaseline(JComponent c, int width, int height)返回基线。protected RectanglegetBox(Rectangle r)存储将在r为当前动画索引绘制的弹跳框的位置和大小,并返回r。SynthContextgetContext(JComponent c)返回指定组件的上下文。DimensiongetPreferredSize(JComponent c)返回指定组件的偏好大小,适合外观和感觉。protected voidinstallDefaults()安装默认属性。protected voidinstallListeners()注册听众。voidpaint(Graphics g, JComponent c)根据外观和外观绘制指定的组件。protected voidpaint(SynthContext context, Graphics g)绘制指定的组件。voidpaintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)画边框protected voidpaintText(SynthContext context, Graphics g, String title)绘制组件的文本。voidpropertyChange(PropertyChangeEvent e)当绑定属性更改时,此方法将被调用。protected voidsetAnimationIndex(int newValue)将当前动画帧的索引设置为指定的值,并请求重绘进度条。protected voiduninstallDefaults()Unintalls默认属性。protected voiduninstallListeners()删除此对象安装的所有侦听器。voidupdate(Graphics g, JComponent c)通知此UI代理重新绘制指定的组件。-
Methods inherited from class javax.swing.plaf.basic.BasicProgressBarUI
getAmountFull, getAnimationIndex, getBaselineResizeBehavior, getBoxLength, getCellLength, getCellSpacing, getFrameCount, getMaximumSize, getMinimumSize, getPreferredInnerHorizontal, getPreferredInnerVertical, getSelectionBackground, getSelectionForeground, getStringPlacement, incrementAnimationIndex, installUI, paintDeterminate, paintIndeterminate, paintString, setCellLength, setCellSpacing, startAnimationTimer, stopAnimationTimer, uninstallUI
-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount
-
-
-
-
方法详细信息
-
createUI
public static ComponentUI createUI(JComponent x)
为给定的组件创建一个新的UI对象。- 参数
-
x- 为其创建UI对象的组件 - 结果
- UI对象
-
installListeners
protected void installListeners()
注册听众。
-
uninstallListeners
protected void uninstallListeners()
删除此对象安装的所有侦听器。
-
installDefaults
protected void installDefaults()
安装默认属性。
-
uninstallDefaults
protected void uninstallDefaults()
Unintalls默认属性。
-
getContext
public SynthContext getContext(JComponent c)
返回指定组件的上下文。- Specified by:
-
getContext接口SynthUI - 参数
-
c- 组件请求SynthContext。 - 结果
- SynthContext描述组件。
-
getBaseline
public int getBaseline(JComponent c, int width, int height)
返回基线。- 重写:
-
getBaseline在BasicProgressBarUI - 参数
-
c-JComponent正在请求基准 -
width- 获取基准的宽度 -
height- 获取基准的高度 - 结果
- 基线或值<0表示没有合理的基线
- 另请参见:
-
JComponent.getBaseline(int, int)
-
getBox
protected Rectangle getBox(Rectangle r)
存储将在r为当前动画索引绘制的弹跳框的位置和大小,并返回r。 这增加在这一类的实现的执行画子类paintIndeterminate-画出轮廓周围的跳动框,例如-可以使用此方法获取刚刚绘制的跳动框的位置。 通过覆盖此方法,您可以完全控制弹跳框的大小和位置,而无需重新实现paintIndeterminate。- 重写:
-
getBox中的BasicProgressBarUI - 参数
-
r- 要修改的Rectangle实例; 可能是null - 结果
-
null如果没有框应该绘制; 否则,返回传入矩形(如果非空)或新矩形 - 另请参见:
-
BasicProgressBarUI.setAnimationIndex(int)
-
setAnimationIndex
protected void setAnimationIndex(int newValue)
将当前动画帧的索引设置为指定的值,并请求重绘进度条。 不使用默认绘画代码的子类可能需要覆盖此方法才能更改调用repaint方法的方法。- 重写:
-
setAnimationIndex类BasicProgressBarUI - 参数
-
newValue- 新的动画索引; 不对其值进行检查 - 另请参见:
-
BasicProgressBarUI.incrementAnimationIndex()
-
update
public void update(Graphics g, JComponent c)
通知此UI代理重新绘制指定的组件。 该方法绘制组件背景,然后调用paint(SynthContext,Graphics)方法。通常,此方法不需要被子类覆盖。 所有Look和Feel渲染代码都应该在
paint。- 重写:
-
update在ComponentUI - 参数
-
g- 用于绘画的Graphics对象 -
c- 正在涂漆的组件 - 另请参见:
-
paint(SynthContext,Graphics)
-
paint
public void paint(Graphics g, JComponent c)
根据外观和外观绘制指定的组件。Synth Look and Feel不使用此方法。 绘画由
paint(SynthContext,Graphics)处理。- 重写:
-
paint在BasicProgressBarUI - 参数
-
g- 用于绘画的Graphics对象 -
c- 正在涂漆的组件 - 另请参见:
-
paint(SynthContext,Graphics)
-
paint
protected void paint(SynthContext context, Graphics g)
绘制指定的组件。- 参数
-
context- 正在绘制的组件的上下文 -
g- 用于绘画的Graphics对象 - 另请参见:
-
update(Graphics,JComponent)
-
paintText
protected void paintText(SynthContext context, Graphics g, String title)
绘制组件的文本。- 参数
-
context- 正在绘制的组件的上下文 -
g-Graphics用于绘画的对象 -
title- 要绘画的文字
-
paintBorder
public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)
画边框- Specified by:
-
paintBorder在接口SynthUI - 参数
-
context- 组件上下文 -
g-Graphics上画 -
x- X坐标 -
y- Y坐标 -
w- 边框的宽度 -
h- 边框的高度
-
propertyChange
public void propertyChange(PropertyChangeEvent e)
当绑定属性更改时,此方法将被调用。- Specified by:
-
propertyChange在接口PropertyChangeListener - 参数
-
e- 描述事件源和已更改的属性的PropertyChangeEvent对象。
-
getPreferredSize
public Dimension getPreferredSize(JComponent c)
返回指定组件的偏好大小,适合外观和感觉。 如果返回null,则首选的大小将由组件的布局管理器计算(这是安装了特定布局管理器的任何组件的首选方法)。 此方法的默认实现返回null。- 重写:
-
getPreferredSize在BasicProgressBarUI - 参数
-
c- 要查询其首选大小的组件; 这个参数经常被忽略,但如果UI对象是无状态的并且被多个组件共享,则可能会被使用 - 结果
-
一个
Dimension对象,包含给定组件的首选大小,适合外观和感觉 - 另请参见:
-
JComponent.getPreferredSize(),LayoutManager.preferredLayoutSize(java.awt.Container)
-
-