- java.lang.Object
-
- javax.swing.LookAndFeel
-
- javax.swing.plaf.basic.BasicLookAndFeel
-
- javax.swing.plaf.synth.SynthLookAndFeel
-
- All Implemented Interfaces:
-
Serializable
- 已知直接子类:
-
NimbusLookAndFeel
public class SynthLookAndFeel extends BasicLookAndFeel
SynthLookAndFeel提供了创建自定义外观的基础。 SynthLookAndFeel不直接提供外观,所有绘画都被委派。 您需要通过load(java.io.InputStream, java.lang.Class<?>)方法提供配置文件,或者将自己的SynthStyleFactory提供给setStyleFactory(javax.swing.plaf.synth.SynthStyleFactory)。 请参阅package summary ,用于加载文件的例子,并SynthStyleFactory提供你自己的一个例子SynthStyleFactory至setStyleFactory。SynthIcon接口提供paintIcon(synthContext, graphics, x, y, width, height)方法,允许绘制给定的图标SynthContext。警告:此类实现
Serializable作为副作用扩展BasicLookAndFeel。 它不打算串行化。 尝试序列化它将导致NotSerializableException。- 从以下版本开始:
- 1.5
-
-
构造方法摘要
构造方法 Constructor 描述 SynthLookAndFeel()创建SynthLookAndFeel。
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 static ComponentUIcreateUI(JComponent c)创建Synth的外观和感觉ComponentUI为传递JComponent。UIDefaultsgetDefaults()返回此SynthLookAndFeel的默认值。StringgetDescription()返回SynthLookAndFeel的文本描述。StringgetID()返回一个识别这种外观和感觉的字符串。StringgetName()返回一个标识这种外观和感觉的短字符串。static RegiongetRegion(JComponent c)返回JComponent的区域c。static SynthStylegetStyle(JComponent c, Region region)获取指定组件的指定区域的SynthStyle。static SynthStyleFactorygetStyleFactory()返回当前的SynthStyleFactory。voidinitialize()当这个外观和感觉被安装时,由UIManager打来的。booleanisNativeLookAndFeel()返回false,SynthLookAndFeel不是原生的外观。booleanisSupportedLookAndFeel()返回true,始终支持SynthLookAndFeel。voidload(InputStream input, Class<?> resourceBase)加载组SynthStyle将由本使用的SSynthLookAndFeel。voidload(URL url)加载组SynthStyle将由本使用的SSynthLookAndFeel。static voidsetStyleFactory(SynthStyleFactory cache)设置SynthStyleFactory,合成器提供的UI类将用于获取SynthStyle。booleanshouldUpdateStyleOnAncestorChanged()返回当SynthStyleFactory的祖先发生变化时,UI是否应从SynthStyles更新JComponent。protected booleanshouldUpdateStyleOnEvent(PropertyChangeEvent ev)返回在特定事件发生时,UI是否应更新其样式。voiduninitialize()当这个外观和感觉被卸载时,由UIManager打电话。static voidupdateStyles(Component c)更新与c及其所有子项相关联的样式。-
Methods inherited from class javax.swing.plaf.basic.BasicLookAndFeel
createAudioAction, getAudioActionMap, initClassDefaults, initComponentDefaults, initSystemColorDefaults, loadSystemColors, playSound
-
Methods inherited from class javax.swing.LookAndFeel
getDesktopPropertyValue, getDisabledIcon, getDisabledSelectedIcon, getLayoutStyle, getSupportsWindowDecorations, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, provideErrorFeedback, toString, uninstallBorder
-
-
-
-
方法详细信息
-
setStyleFactory
public static void setStyleFactory(SynthStyleFactory cache)
设置SynthStyleFactory,合成器提供的UI类将用于获取SynthStyle。- 参数
-
cache- 用户界面应该使用的SynthStyleFactory。
-
getStyleFactory
public static SynthStyleFactory getStyleFactory()
返回当前的SynthStyleFactory。- 结果
- 的SynthStyleFactory
-
getStyle
public static SynthStyle getStyle(JComponent c, Region region)
获取指定组件的指定区域的SynthStyle。 这不是一般消费,只有自定义UI应该调用这种方法。- 参数
-
c- 获取SynthStyle的JComponent -
region- 标识指定组件的区域 - 结果
- SynthStyle使用。
-
updateStyles
public static void updateStyles(Component c)
更新与c及其所有子项相关联的样式。 这是一个较轻的版本的SwingUtilities.updateComponentTreeUI。- 参数
-
c- 更新样式的组件。
-
getRegion
public static Region getRegion(JComponent c)
返回JComponent的区域c。- 参数
-
c- 获取区域的JComponent - 结果
-
区域对应
c
-
createUI
public static ComponentUI createUI(JComponent c)
创建Synth外观和感觉ComponentUI为JComponent传递。- 参数
-
c- JComponent创建ComponentUI - 结果
-
ComponentUI用于
c
-
load
public void load(InputStream input, Class<?> resourceBase) throws ParseException
加载组SynthStyle将由本使用的SSynthLookAndFeel。resourceBase用于解析任何基于路径的资源,例如Image将由resourceBase.getResource(path)解决。 有关详细信息,请参阅Synth File Format 。- 参数
-
input- 要加载的InputStream -
resourceBase- 用于解析任何图像或其他资源 - 异常
-
ParseException- 如果解析中有错误 -
IllegalArgumentException- 如果input或resourceBase为null
-
load
public void load(URL url) throws ParseException, IOException
加载组SynthStyle将由本使用的SSynthLookAndFeel。 基于路径的资源相对于指定的URL的风格进行了解决。 例如Image将由new URL(synthFile, path)解决。 有关详细信息,请参阅Synth File Format 。- 参数
-
url-URL将SynthStyle从 - 异常
-
ParseException- 如果解析中有错误 -
IllegalArgumentException- 如果synthSet是null -
IOException- 如果synthSet无法作为InputStream打开 - 从以下版本开始:
- 1.6
-
initialize
public void initialize()
当这个外观和感觉被安装时,由UIManager打来的。
-
uninitialize
public void uninitialize()
当这个外观和感觉被卸载时,由UIManager打电话。
-
getDefaults
public UIDefaults getDefaults()
返回此SynthLookAndFeel的默认值。
-
isSupportedLookAndFeel
public boolean isSupportedLookAndFeel()
返回true,始终支持SynthLookAndFeel。- Specified by:
-
isSupportedLookAndFeel在LookAndFeel - 结果
- 真正。
- 另请参见:
-
UIManager.setLookAndFeel(javax.swing.LookAndFeel)
-
isNativeLookAndFeel
public boolean isNativeLookAndFeel()
返回false,SynthLookAndFeel不是原生的外观。- Specified by:
-
isNativeLookAndFeel在LookAndFeel - 结果
- 假
-
getDescription
public String getDescription()
返回SynthLookAndFeel的文本描述。- Specified by:
-
getDescription在LookAndFeel - 结果
- 合成器的文字描述。
-
getName
public String getName()
返回一个标识这种外观和感觉的短字符串。- Specified by:
-
getName在LookAndFeel - 结果
- 一个短的字符串识别这种外观和感觉。
-
getID
public String getID()
返回一个识别这种外观和感觉的字符串。- Specified by:
-
getID在LookAndFeel - 结果
- 一个短的字符串识别这种外观和感觉。
-
shouldUpdateStyleOnAncestorChanged
public boolean shouldUpdateStyleOnAncestorChanged()
返回UI是否应更新SynthStyles从SynthStyleFactory当祖先的JComponent发生变化。 提供了一个SynthStyleFactory子类,它基于从包含层次结构的getStyle返回值,将覆盖此方法返回true。- 结果
-
当祖先改变时,UI是否应该从
SynthStyleFactory更新SynthStyles。
-
shouldUpdateStyleOnEvent
protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev)
返回在特定事件发生时,UI是否应更新其样式。- 参数
-
ev- aPropertyChangeEvent - 结果
- UI是否应该更新其样式
- 从以下版本开始:
- 1.7
-
-