Look and Feel is not updated on all subcomponents

Asked

Viewed 121 times

2

I am facing a problem with the look and Feel that I found a little strange, when running the project by the IDE all components are rendered according to the skin I selected, but when I use the JAR, some components are not rendered with the theme I chose.

Both the JAR and the IDE are initiated through the code below:

public class App 
{
    public static void main(final String[] args) throws ParseException, UnsupportedLookAndFeelException 
    {
        UIManager.setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel());

        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                Principal.main(args);
            }
        });
     }
}

Someone has already gone through something similar, the program works perfectly without any error.

Here is the library documentation link Substance that I’m using.

Version of Java CMD:

>java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_05

In the IDE it’s the same: JAVA IDE

  • You may have two versions of Java installed on your pc. For example, running through an IDE it uses one, and giving two clicks in the jar it rotates another, and this can cause some subtle differences. Which IDE are you using? Can you tell which JRE it uses? Try running the jar by cmd using the command java -jar arquivo.jar. On cmd you can check the JRE version by doing java -version. Make sure it’s the same one the IDE uses. If you cannot solve your problem, try generating an example (MCVE)[pt.stackoverflow.com/help/mcve] and post images if possible.

  • I’m using only one version of java, I’m using Eclipse.

  • I did the test on other machines and with Java 7 and it also looks the same. To thinking that could be differences between JDK and JRE.

  • I don’t understand why you’re calling another Static main function by giving it the args argument. When you create Jframe with all components and when you try to update L&F, you should approach the creation of the object with a Try/catch construct. If you do not show the code in the other main function, it is difficult to say and help much more.

  • 1

    @claudsan choose your answer as the one that answers your question. Here we do not use [Solved]

  • @gmsantos I can not mark as reply, I will edit the title, thanks.

Show 1 more comment

1 answer

1

Actually it was not a "problem" what happens is when I The executable jar by eclipse I was selecting the option Packaging required libraries into generate JAR with this the Eclipse replaces the main class of the jar with this org.eclipse.jdt.internal.jarinjarloader.

Exportação Eclipse

//A classe principal fica assim, e o skin MÃO funciona 100% alguns 
//componentes não aplicava o skin correto.
Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader

I switched to the option: Extract required libraries into generate JAR I didn’t understand the reason but it worked for me. Because anyway it goes through my App class.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.