当前位置: 技术问答>java相关
如何正确使用好java look and feel?
来源: 互联网 发布时间:2015-03-03
本文导语: 我用的是jdk1.2.2,IDE是JCreator2.5 从网上下载了一个Kunststoff Look&Feel 1.1.1 按其使用提示,我把kunststoff.jar和我的java文件ButtonTest放在同一目录下, 主页面里就只放入三个Button 在程序里用 try { UIManag...
我用的是jdk1.2.2,IDE是JCreator2.5
从网上下载了一个Kunststoff Look&Feel 1.1.1
按其使用提示,我把kunststoff.jar和我的java文件ButtonTest放在同一目录下,
主页面里就只放入三个Button
在程序里用
try
{
UIManager.setLookAndFeel(new com.incors.plaf.kunststoff.KunststoffLookAndFeel());
SwingUtilities.updateComponentTreeUI(this);
}
catch(Exception e)
{
}
来使用该LAF,并在编译和运行时都用-classpath参数把kunststoff.jar文件包含进去,
编译没错误提示,运行时确只有一个Frame显示,无Button,好像背景颜色也变了,并
出现如下错误提示:
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JButton[,0,0,0x0,invalid,layout=javax.swing.OverlayLayout,alignmentX=null,alignmentY=null,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=null,paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Yellow,defaultCapable=true]
java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:351)
at javax.swing.UIDefaults.getUI(UIDefaults.java:377)
at javax.swing.UIManager.getUI(UIManager.java:544)
at javax.swing.JButton.updateUI(JButton.java:115)
at javax.swing.AbstractButton.init(AbstractButton.java:1196)
at javax.swing.JButton.(JButton.java:105)
at javax.swing.JButton.(JButton.java:91)
at ButtonPanel.(ButtonTest.java:16)
at ButtonFrame.(ButtonTest.java:71)
at ButtonTest.main(ButtonTest.java:79)
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JButton[,0,0,0x0,invalid,layout=javax.swing.OverlayLayout,alignmentX=null,alignmentY=null,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=null,paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Blue,defaultCapable=true]
java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:351)
at javax.swing.UIDefaults.getUI(UIDefaults.java:377)
at javax.swing.UIManager.getUI(UIManager.java:544)
at javax.swing.JButton.updateUI(JButton.java:115)
at javax.swing.AbstractButton.init(AbstractButton.java:1196)
at javax.swing.JButton.(JButton.java:105)
at javax.swing.JButton.(JButton.java:91)
at ButtonPanel.(ButtonTest.java:17)
at ButtonFrame.(ButtonTest.java:71)
at ButtonTest.main(ButtonTest.java:79)
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JButton[,0,0,0x0,invalid,layout=javax.swing.OverlayLayout,alignmentX=null,alignmentY=null,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=null,paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=red,defaultCapable=true]
java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:351)
at javax.swing.UIDefaults.getUI(UIDefaults.java:377)
at javax.swing.UIManager.getUI(UIManager.java:544)
at javax.swing.JButton.updateUI(JButton.java:115)
at javax.swing.AbstractButton.init(AbstractButton.java:1196)
at javax.swing.JButton.(JButton.java:105)
at javax.swing.JButton.(JButton.java:91)
at ButtonPanel.(ButtonTest.java:18)
at ButtonFrame.(ButtonTest.java:71)
at ButtonTest.main(ButtonTest.java:79)
请教哪位使用过类似LAF的,如何才能正确使用好这样的外观,是不是我在哪个设置方面
出现了问题?
从网上下载了一个Kunststoff Look&Feel 1.1.1
按其使用提示,我把kunststoff.jar和我的java文件ButtonTest放在同一目录下,
主页面里就只放入三个Button
在程序里用
try
{
UIManager.setLookAndFeel(new com.incors.plaf.kunststoff.KunststoffLookAndFeel());
SwingUtilities.updateComponentTreeUI(this);
}
catch(Exception e)
{
}
来使用该LAF,并在编译和运行时都用-classpath参数把kunststoff.jar文件包含进去,
编译没错误提示,运行时确只有一个Frame显示,无Button,好像背景颜色也变了,并
出现如下错误提示:
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JButton[,0,0,0x0,invalid,layout=javax.swing.OverlayLayout,alignmentX=null,alignmentY=null,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=null,paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Yellow,defaultCapable=true]
java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:351)
at javax.swing.UIDefaults.getUI(UIDefaults.java:377)
at javax.swing.UIManager.getUI(UIManager.java:544)
at javax.swing.JButton.updateUI(JButton.java:115)
at javax.swing.AbstractButton.init(AbstractButton.java:1196)
at javax.swing.JButton.(JButton.java:105)
at javax.swing.JButton.(JButton.java:91)
at ButtonPanel.(ButtonTest.java:16)
at ButtonFrame.(ButtonTest.java:71)
at ButtonTest.main(ButtonTest.java:79)
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JButton[,0,0,0x0,invalid,layout=javax.swing.OverlayLayout,alignmentX=null,alignmentY=null,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=null,paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Blue,defaultCapable=true]
java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:351)
at javax.swing.UIDefaults.getUI(UIDefaults.java:377)
at javax.swing.UIManager.getUI(UIManager.java:544)
at javax.swing.JButton.updateUI(JButton.java:115)
at javax.swing.AbstractButton.init(AbstractButton.java:1196)
at javax.swing.JButton.(JButton.java:105)
at javax.swing.JButton.(JButton.java:91)
at ButtonPanel.(ButtonTest.java:17)
at ButtonFrame.(ButtonTest.java:71)
at ButtonTest.main(ButtonTest.java:79)
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JButton[,0,0,0x0,invalid,layout=javax.swing.OverlayLayout,alignmentX=null,alignmentY=null,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=null,paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=red,defaultCapable=true]
java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:351)
at javax.swing.UIDefaults.getUI(UIDefaults.java:377)
at javax.swing.UIManager.getUI(UIManager.java:544)
at javax.swing.JButton.updateUI(JButton.java:115)
at javax.swing.AbstractButton.init(AbstractButton.java:1196)
at javax.swing.JButton.(JButton.java:105)
at javax.swing.JButton.(JButton.java:91)
at ButtonPanel.(ButtonTest.java:18)
at ButtonFrame.(ButtonTest.java:71)
at ButtonTest.main(ButtonTest.java:79)
请教哪位使用过类似LAF的,如何才能正确使用好这样的外观,是不是我在哪个设置方面
出现了问题?
|
http://java.sun.com/products/jlf2/guidelines.html
http://java.sun.com/products/personaljava/touchable/
http://java.sun.com/products/jfc/tsc/articles/jlf/index.html
http://java.sun.com/products/personaljava/touchable/
http://java.sun.com/products/jfc/tsc/articles/jlf/index.html