public class BasicLabelUI extends LabelUI implements PropertyChangeListener
Modifier and Type | Field and Description |
---|---|
protected static BasicLabelUI |
labelUI
默认
BasicLabelUI 实例。
|
Constructor and Description |
---|
BasicLabelUI() |
Modifier and Type | Method and Description |
---|---|
static ComponentUI |
createUI(JComponent c) |
int |
getBaseline(JComponent c, int width, int height)
返回基线。
|
Component.BaselineResizeBehavior |
getBaselineResizeBehavior(JComponent c)
返回一个枚举指示组件的尺寸的变化的基线。
|
Dimension |
getMaximumSize(JComponent c)
返回指定组件的最大大小适合的外观和感觉。
|
Dimension |
getMinimumSize(JComponent c)
返回指定组件的最小大小适合的外观和感觉。
|
Dimension |
getPreferredSize(JComponent c)
返回指定组件的首选大小适合的外观和感觉。
|
protected void |
installComponents(JLabel c) |
protected void |
installDefaults(JLabel c) |
protected void |
installKeyboardActions(JLabel l) |
protected void |
installListeners(JLabel c) |
void |
installUI(JComponent c)
配置指定的组件适当的外观和感觉。
|
protected String |
layoutCL(JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR)
将调用转发给layoutcompoundlabel() swingutilities。
|
void |
paint(Graphics g, JComponent c)
如果标签是不透明的,则用前景颜色绘制标签文本,然后用背景色绘制整个背景。
|
protected void |
paintDisabledText(JLabel l, Graphics g, String s, int textX, int textY)
油漆clippedtext在textx,texty背景。lighter()然后移向下和向右一像素与背景。darker()。
|
protected void |
paintEnabledText(JLabel l, Graphics g, String s, int textX, int textY)
油漆clippedtext在textx,与标签的前景颜色texty。
|
void |
propertyChange(PropertyChangeEvent e)
当改变绑定属性时,这种方法会被调用。
|
protected void |
uninstallComponents(JLabel c) |
protected void |
uninstallDefaults(JLabel c) |
protected void |
uninstallKeyboardActions(JLabel c) |
protected void |
uninstallListeners(JLabel c) |
void |
uninstallUI(JComponent c)
逆转形态,完成指定的组件在
installUI 。
|
contains, getAccessibleChild, getAccessibleChildrenCount, update
protected static BasicLabelUI labelUI
BasicLabelUI
实例。这个字段可能不会被使用。要更改默认实例使用一个子类,重写
createUI
方法和地点,默认表类的名称下的关键“labelui”。
protected String layoutCL(JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR)
protected void paintEnabledText(JLabel l, Graphics g, String s, int textX, int textY)
protected void paintDisabledText(JLabel l, Graphics g, String s, int textX, int textY)
public void paint(Graphics g, JComponent c)
paintEnabledText(javax.swing.JLabel, java.awt.Graphics, java.lang.String, int, int)
或
paintDisabledText(javax.swing.JLabel, java.awt.Graphics, java.lang.String, int, int)
绘制。计算
layoutCL(javax.swing.JLabel, java.awt.FontMetrics, java.lang.String, javax.swing.Icon, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle)
是标签部分的位置。
paint
方法重写,继承类
ComponentUI
g
-其中
Graphics
背景画
c
-正在绘制的构件;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
paintEnabledText(javax.swing.JLabel, java.awt.Graphics, java.lang.String, int, int)
,
paintDisabledText(javax.swing.JLabel, java.awt.Graphics, java.lang.String, int, int)
,
layoutCL(javax.swing.JLabel, java.awt.FontMetrics, java.lang.String, javax.swing.Icon, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle)
public Dimension getPreferredSize(JComponent c)
ComponentUI
null
返回,首选大小将由组件的布局管理器的计算(这是与一个特定的布局管理器安装任何组件的首选方法)。此方法的默认实现将返回
null
。
getPreferredSize
方法重写,继承类
ComponentUI
c
优先度的被查询的成分;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
JComponent.getPreferredSize()
,
LayoutManager.preferredLayoutSize(java.awt.Container)
public Dimension getMinimumSize(JComponent c)
ComponentUI
null
返回,最小尺寸将由组件的布局管理器的计算(这是与一个特定的布局管理器安装任何组件的首选方法)。此方法的默认实现调用
getPreferredSize
和返回值。
getMinimumSize
方法重写,继承类
ComponentUI
c
最小尺寸的是被查询的成分;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
JComponent.getMinimumSize()
,
LayoutManager.minimumLayoutSize(java.awt.Container)
,
ComponentUI.getPreferredSize(javax.swing.JComponent)
public Dimension getMaximumSize(JComponent c)
ComponentUI
null
返回,最大规模将由组件的布局管理器的计算(这是与一个特定的布局管理器安装任何组件的首选方法)。此方法的默认实现调用
getPreferredSize
和返回值。
getMaximumSize
方法重写,继承类
ComponentUI
c
-其最大尺寸被查询的成分;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
JComponent.getMaximumSize()
,
LayoutManager2.maximumLayoutSize(java.awt.Container)
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)
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(JLabel c)
protected void installListeners(JLabel c)
protected void installComponents(JLabel c)
protected void installKeyboardActions(JLabel l)
protected void uninstallDefaults(JLabel c)
protected void uninstallListeners(JLabel c)
protected void uninstallComponents(JLabel c)
protected void uninstallKeyboardActions(JLabel c)
public static ComponentUI createUI(JComponent c)
public void propertyChange(PropertyChangeEvent e)
PropertyChangeListener
propertyChange
接口
PropertyChangeListener
e
- PropertyChangeEvent对象描述事件源和性质已经改变。
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.