所有类


java.beans
类 PropertyEditorSupport

java.lang.Object
  继承者 java.beans.PropertyEditorSupport
所有已实现的接口:
PropertyEditor

public class PropertyEditorSupport
   
   
   
   
   
extends Object
implements PropertyEditor

这是一个帮助构建属性编辑器的支持类。

可以将该类用作一个基类或是一个代理。


构造方法摘要
PropertyEditorSupport()
          构造一个 PropertyEditorSupport 对象。
PropertyEditorSupport(Object source)
          构造一个 PropertyEditorSupport 对象。
 
方法摘要
 voidaddPropertyChangeListener(PropertyChangeListener listener)
          注册一个用于 PropertyChange 事件的侦听器。
 voidfirePropertyChange()
          报告是否已经修改所有感兴趣的侦听器。
 StringgetAsText()
          获得人类可编辑的适当字符串表示形式的属性值。
 ComponentgetCustomEditor()
          PropertyEditor 可以选择使用完全自定义的 Component 来编辑自己的属性值。
 StringgetJavaInitializationString()
          生成 Java 代码来设置属性值时使用此方法。
 ObjectgetSource()
          返回用作事件源的 bean。
 String[]getTags()
          如果属性值必须是一组已知的加标记值之一,则此方法应该返回一个标记值数组。
 ObjectgetValue()
          获得属性值。
 booleanisPaintable()
          确定该类是否支持 painValue 方法。
 voidpaintValue(Graphics gfx, Rectangle box)
          在屏幕实际状态给定区域中绘制值的表示形式。
 voidremovePropertyChangeListener(PropertyChangeListener listener)
          移除一个用于 PropertyChange 事件的侦听器。
 voidsetAsText(String text)
          通过解析给定字符串设置属性值。
 voidsetSource(Object source)
          设置源 bean。
 voidsetValue(Object value)
          设置(或更改)将被编辑的对象。
 booleansupportsCustomEditor()
          确定 propertyEditor 是否可以提供自定义编辑器。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

PropertyEditorSupport

public PropertyEditorSupport()
构造一个 PropertyEditorSupport 对象。

从以下版本开始:
1.5

PropertyEditorSupport

public PropertyEditorSupport(Object source)
构造一个 PropertyEditorSupport 对象。

参数:
source - 用来激发事件的源
从以下版本开始:
1.5
方法详细信息

getSource

public Object getSource()
返回用作事件源的 bean。如果没有显式设置源,则返回 PropertyEditorSupport 的此实例。

返回:
源对象或此实例
从以下版本开始:
1.5

setSource

public void setSource(Object source)
设置源 bean。

源 bean 被用作属性更改的事件源。此源应该仅用于获得信息,不应被 PropertyEditor 修改。

参数:
source - 将用于事件的源对象
从以下版本开始:
1.5

setValue

public void setValue(Object value)
设置(或更改)将被编辑的对象。

指定者:
接口 PropertyEditor 中的 setValue
参数:
value - 要编辑的新目标对象。注意,不应由 PropertyEditor 修改此对象,相反 PropertyEditor 应该创建一个新对象来保存所有修改值。

getValue

public Object getValue()
获得属性值。

指定者:
接口 PropertyEditor 中的 getValue
返回:
属性值。

isPaintable

public boolean isPaintable()
确定该类是否支持 painValue 方法。

指定者:
接口 PropertyEditor 中的 isPaintable
返回:
如果该类支持 paintValue 方法,则返回 true。

paintValue

public void paintValue(Graphics gfx,
                       Rectangle box)
在屏幕实际状态给定区域中绘制值的表示形式。注意,propertyEditor 负责裁剪自身,以适应给定的矩形。

如果 PropertyEditor 不支持绘制请求(参见 isPaintable),则此方法应该是一个静寂的无操作 (noop)。

指定者:
接口 PropertyEditor 中的 paintValue
参数:
gfx - 要绘制的 Graphics 对象。
box - 应该在其中绘制图形对象的矩形。