我在我的java项目中使用netbeans,我想在我的项目中添加synthetica外观。
这是我设置Synthetica外观的代码
public static void main(String[] args) {
MainFrame mf = new MainFrame();
try{
UIManager.setLookAndFeel(new SyntheticaSilverMoonLookAndFeel());
mf.setVisible(true);
mf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}catch(Exception e){
System.out.println(e);
}
}
我已将synthetica.jar
和syntheticaSilverMoon.jar
添加到我的库中。
但是,当我试图运行该项目时,它给了我
Exception in thread "main" java.lang.NoClassDefFoundError: sun/swing/plaf/synth/SynthUI
at de.javasoft.plaf.synthetica.SyntheticaDefaultLookup.getDefault(SyntheticaDefaultLookup.java:84)
at sun.swing.DefaultLookup.get(DefaultLookup.java:125)
at javax.swing.plaf.basic.BasicButtonListener.getInputMap(BasicButtonListener.java:119)
at javax.swing.plaf.basic.BasicButtonListener.installKeyboardActions(BasicButtonListener.java:95)
at javax.swing.plaf.basic.BasicButtonUI.installKeyboardActions(BasicButtonUI.java:138)
at javax.swing.plaf.basic.BasicButtonUI.installUI(BasicButtonUI.java:90)
at javax.swing.JComponent.setUI(JComponent.java:666)
at javax.swing.AbstractButton.setUI(AbstractButton.java:1810)
at javax.swing.JButton.updateUI(JButton.java:147)
at javax.swing.AbstractButton.init(AbstractButton.java:2176)
at javax.swing.JButton.<init>(JButton.java:137)
at javax.swing.JButton.<init>(JButton.java:91)
at de.javasoft.plaf.synthetica.SyntheticaLookAndFeel.installCompatibilityDefaults(SyntheticaLookAndFeel.java:553)
at de.javasoft.plaf.synthetica.SyntheticaLookAndFeel.access$4(SyntheticaLookAndFeel.java:405)
at de.javasoft.plaf.synthetica.SyntheticaLookAndFeel$2.propertyChange(SyntheticaLookAndFeel.java:313)
at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyChangeSupport.java:92)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:548)
at courseenrollmentsystem.CourseEnrollmentSystem.main(CourseEnrollmentSystem.java:26)
Caused by: java.lang.ClassNotFoundException: sun.swing.plaf.synth.SynthUI
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 21 more
我的代码有什么问题?需要帮助。
答案 0 :(得分:0)
这个问题似乎重复,看起来你正在使用不支持最新JDK的旧版Synthetica。请下载支持最新JDK的最新Synthetica&gt; 7.您可以在这里参考这个question