public interface UIResource
ComponentUI.installUI()
和
ComponentUI.uninstallUI()
方法可以使用这个接口来决定如果一个属性值被覆盖。例如,JList cellrenderer属性初始化的basiclistui。installui(),只有当它的初始值为空:
如果(列表。getcellrenderer() = = null){列表。setcellrenderer((listcellrenderer)(UIManager.得到(”名单。cellrenderer”)));}在uninstallui()时间我们属性重置为零如果其值为UIResource实例来:
如果(列表。getcellrenderer()是uiresource){setcellrenderer(null)列表;}这种模式适用于除java.awt.component属性的字体,前景和背景的所有属性。如果这些属性中的一个未初始化,或显式设置为空,则它的容器提供了值。为此,
"== null"
是不可靠时,installui()叫做动态改变组件的外观和感觉。所以在installui()时间我们看看当前的值是一个uiresource:
如果(!(列表。getfont()是uiresource)){列表。设置字体(UIManager.获得当前字体(”名单。字体”));}
ComponentUI
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.