I am using Substance Look and Feel for my Swing GUI application with Netbeans and Maven.
When I run the project from within Netbeans, the Look and Feel is applied, but when I clean and build the project and execute the jar produced by maven, the GUI reverts to the default look and feel.
Also, while inspecting the produced jar, I dont see the substance files anywhere.
I have added the substance dependency through maven and even tried changing it scope to runtime, but there was no change. I encounter no errors or exceptions while compiling or executing the program. What is the problem?
I am using JDK 7 on a 64 bit Windows 8 machine.
Here is the code for setting the LaF:
try {
UIManager.setLookAndFeel("org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel");
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
Logger.getLogger(Texus.class.getName()).log(Level.SEVERE, null, ex);
}
And here is my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.pawandubey</groupId>
<artifactId>Texus</artifactId>
<version>0.1-ALPHA</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.pawandubey.texus.Texus</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.insubstantial</groupId>
<artifactId>substance</artifactId>
<version>7.2.1</version>
</dependency>
<dependency>
<groupId>com.seaglasslookandfeel</groupId>
<artifactId>seaglasslookandfeel</artifactId>
<version>0.2</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
See QuickStartJavaMavenProject. It explains you should use the maven-assemply-plugin to create a jar with your dependencies. Something like
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.areaofthoughts.grumpycat.GrumpyCat</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>