1

I have a swing application, that has its look and feel set to the custom L&F from the company at the main method, where the application is started. The problem is: This works for ALL frames and windows, but somehow it doesn't work for JDialogs.

I've even manually set the L&F during the initialization of the dialog, but still get the platform dependent L&F.

Looking for answers or bugs that might explain this behavior, I found this thread, that explains that the environment variables change the behavior of the UIManager, so I've set the variables swing.crossplatformlaf and swing.systemlaf to return my custom L&F, but still get the OS dependent L&F.

Is there something that I'm missing here? How can Swing configure a different L&F for just JDialogs? I'm having a different L&F on Linux and Windows because of this.

Any help would be appreciated.

Alexander Rumanovsk
  • 2,043
  • 4
  • 21
  • 33
  • 2
    A component uses the LAF at the time the component is created. So you must set the LAF BEFORE creating any components, not when you initialize the dialog. Post a proper [mre] is you need more help. – camickr Mar 25 '20 at 15:04
  • @camickr I set the LAF during the initialization: "java -Dswing.crossplatformlaf="com.mycompany.MyLookAndFeel" -Dswing.systemlaf="com.mycompany.MyLookAndFeel" ..." – Alexander Rumanovsk Mar 25 '20 at 15:11
  • If you set the style of the application inside the Main method or frame method with UIManager, your application doesn't have a personal L&F but have a personal Style. The answer depends on your code and your l&f or your UIManager configuration – vincenzopalazzo Apr 12 '20 at 17:31

0 Answers0