2

Java で実体のルック アンド フィールを設定する際に問題があります。私のPCにはJDK 1.8がインストールされています。これらのjarファイルをインポートしました:

  1. laf-widget-5.0.jar
  2. substance-6.0.jar
  3. trident.jar

プログラムを実行すると、一連のエラーが発生します。これが私のコードです:

import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.*;

import org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel;

public class Walkthrough extends JFrame {
    public Walkthrough() {
        super("Sample app");
        this.setLayout(new FlowLayout());
        this.add(new JButton("button"));
        this.add(new JCheckBox("check"));
        this.add(new JLabel("label"));

        this.setSize(new Dimension(250, 80));
        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(new SubstanceGraphiteLookAndFeel());
                } catch (Exception e) {
                    System.out.println("Substance Graphite failed to initialize");
                }
                Walkthrough w = new Walkthrough();
                w.setVisible(true);
            }
        });
    }
}

そして、ここに私のエラーリストがあります:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at org.pushingpixels.substance.internal.utils.SubstanceColorUtilities.getDefaultBackgroundColor(SubstanceColorUtilities.java:823)
    at org.pushingpixels.substance.internal.utils.SubstanceColorUtilities.getBackgroundFillColor(SubstanceColorUtilities.java:726)
    at org.pushingpixels.substance.internal.ui.SubstancePanelUI.installDefaults(SubstancePanelUI.java:73)
    at javax.swing.plaf.basic.BasicPanelUI.installUI(Unknown Source)
    at javax.swing.JComponent.setUI(Unknown Source)
    at javax.swing.JPanel.setUI(Unknown Source)
    at javax.swing.JPanel.updateUI(Unknown Source)
    at javax.swing.JPanel.<init>(Unknown Source)
    at javax.swing.JPanel.<init>(Unknown Source)
    at javax.swing.JPanel.<init>(Unknown Source)
    at javax.swing.JRootPane.createGlassPane(Unknown Source)
    at javax.swing.JRootPane.<init>(Unknown Source)
    at javax.swing.JFrame.createRootPane(Unknown Source)
    at javax.swing.JFrame.frameInit(Unknown Source)
    at javax.swing.JFrame.<init>(Unknown Source)
    at substanceLookNFeel.Walkthrough.<init>(Walkthrough.java:11)
    at substanceLookNFeel.Walkthrough$1.run(Walkthrough.java:31)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$400(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
4

1 に答える 1