您好,我正在尝试使用此Seaglass外观主题,而我得到的只是此错误:


  线程“主”中的异常java.lang.NoClassDefFoundError:
  sun / swing / plaf / synth / SynthUI


我下载了seaglass jar文件。仍然会收到此错误。我检查了一些stackoverflow帖子,但它们并没有帮助我...

package lookandfeel;

import javax.swing.*;
import com.seaglasslookandfeel.*;

public class LookAndFeel
{

    public static void main(String[] args)
    {

        try
        {
            UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
        } catch (Exception e)
        {
            e.printStackTrace();
        }


        JFrame window = new JFrame("Look and feel");
        window.setVisible(true);
        window.setSize(500, 500);
        window.setResizable(false);
        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JPanel panel = new JPanel();
        window.add(panel);

        JButton button = new JButton("Look And Feel");
        panel.add(button);

        JProgressBar pb = new JProgressBar();
        pb.setValue(75);
        panel.add(pb);
    }
}

最佳答案

只需从mvnrepository.com或直接从github project下载它,因为所有内容都将包括在内,即使您缺少的类sun.swing.plaf.synth.SynthUI

07-28 12:06