eclipse下已经把Substance.jar通过add external jar方式加了进去
代码如下
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;import org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel;public class TheFrame extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L; public TheFrame() {
this.setSize(800, 700);
this.setIconImage(new ImageIcon("resources/left.png").getImage());
this.setVisible(true);
this.setLayout(null);
JButton b = new JButton("按钮");
JCheckBox c = new JCheckBox("CheckBox");
JLabel l = new JLabel("Jlabel");
this.add(b);
this.add(c);
this.add(l);
b.setBounds(20, 20, 80, 40);
c.setBounds(100, 50, 80, 40);
l.setBounds(200, 20, 80, 40);
this.setTitle("Subatance");
// this.setResizable(false);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} public static void main(String args[]) { JFrame.setDefaultLookAndFeelDecorated(true); SwingUtilities.invokeLater(new Runnable() { public void run() {
try {
UIManager
.setLookAndFeel("org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel");
} catch (Exception e) {
System.out
.println("Substance Graphite failed to initialize");
} TheFrame f = new TheFrame();
}
}); }}
运行时报错
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/pushingpixels/trident/ease/TimelineEase
代码如下
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;import org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel;public class TheFrame extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L; public TheFrame() {
this.setSize(800, 700);
this.setIconImage(new ImageIcon("resources/left.png").getImage());
this.setVisible(true);
this.setLayout(null);
JButton b = new JButton("按钮");
JCheckBox c = new JCheckBox("CheckBox");
JLabel l = new JLabel("Jlabel");
this.add(b);
this.add(c);
this.add(l);
b.setBounds(20, 20, 80, 40);
c.setBounds(100, 50, 80, 40);
l.setBounds(200, 20, 80, 40);
this.setTitle("Subatance");
// this.setResizable(false);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} public static void main(String args[]) { JFrame.setDefaultLookAndFeelDecorated(true); SwingUtilities.invokeLater(new Runnable() { public void run() {
try {
UIManager
.setLookAndFeel("org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel");
} catch (Exception e) {
System.out
.println("Substance Graphite failed to initialize");
} TheFrame f = new TheFrame();
}
}); }}
运行时报错
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/pushingpixels/trident/ease/TimelineEase
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货