간단한 모양새를 사용하여 모양새 및 느낌을 시험해 보았습니다. http://seaglass.googlecode.com/과 'nimbus class not found'예외가 발생했습니다. 즉, 해당 위치에 클래스를 볼 수 없습니다 전에Seaglass 모양과 느낌
import java.awt.*;
import javax.swing.*;
public class asd {
private static void createWindow() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
//Create and set up the window.
JFrame frame = new JFrame("Simple GUI");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel textLabel = new JLabel("I'm a label in the window",SwingConstants.CENTER);
textLabel.setPreferredSize(new Dimension(300, 100));
frame.getContentPane().add(textLabel, BorderLayout.CENTER);
//Display the window.
frame.setLocationRelativeTo(null);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
createWindow();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedLookAndFeelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
예외는
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/nimbus/NimbusLookAndFeel
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at javax.swing.SwingUtilities.loadSystemClass(Unknown Source)
at javax.swing.UIManager.setLookAndFeel(Unknown Source)
at asd.main(asd.java:31)
Java 1.5 (또는 이전 버전)를 사용하고있는 것 같습니다. Nimbus 필요 1.6+ –
java -version Java 버전 "1.6.0_25" Java (TM) SE 런타임 환경 (빌드 1.6.0_25-b06) Java HotSpot (TM) 클라이언트 VM (빌드 20.0-b11, 혼합 모드, 공유) – ramya
UIManager 코드를 추출해보고 -Dswing.defaultlaf = com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel 옵션을 사용하여 코드를 시작할 수 있는지 확인하십시오. 이것은 NimbusLAF가 시스템 – Codemwnci