So i have a swing GUI where i change it’s default look and feel based upon some input from another GUI Class using something like this:
javax.swing.UIManager.setLookAndFeel("newlook&feel");
SwingUtilities.updateComponentTreeUI(this);
pack();
This works fine, but however on the console i see everytime this is called an exception is thrown with message like:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
and it refers to line numbers from classes which are internal Java classes. What could be the problem here or i am missing something.
Just a point, SwingUtilities.isEventDispatchThread() returns false in this scenario.
Maybe that is the problem, have you tried invoking the L&F change inside the EDT Thread?