My java program has multiple classes, each containing a separate JFrame. All three JFrames are started in my main class, and are set to setVisible(false) so they are hidden. When a button from a JPopUpMenu is clicked, the respective JFrame is set to setVisible(true). In these classes I have defined:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
When I run each class separately by right-clicking the .java file in NetBeans and choosing Run File, the Look and Feel works perfectly. However, when I run the main class and setVisible(true) on the JFrame, the look and feel does not work. I thought this may have been just an error with NetBeans, so I tried building the .jar and running it. The problem is still there. The main class's Look and Feel has been set using the same code, and that works perfectly. I am not sure what to do. Any help is appreciated.