I have a simple Java Swing app which should be able to change its look and feel (UIManager) afer clicking on a JButton in a JDialog of this JFrame. When I simply set UIManager.setLookAndFeel from JDialog it just changes the theme of the jdialog... how can I do that for the jdialog's "mother-container" JFrame?
Asked
Active
Viewed 161 times
0
-
Ok, you really should understand that the ability to "dynamically" switch look and feels at runtime was never officially support or intended as feature - it was simply a side effect – MadProgrammer Aug 27 '20 at 23:52
-
when you use UIManager.setLookAndFeel after button clicked and jdialog opened so the current control is on jdialog thats why it only changes the theme for that. – Usama Tahir Aug 27 '20 at 23:54
-
[For example](https://stackoverflow.com/questions/33617713/changing-look-and-feel-by-swapping-uidefaults/33619477#33619477) – MadProgrammer Aug 27 '20 at 23:55
-
If you want to change it for the JFrame you can do it on the onload event function of jframe but you have to put some logic that will tell that you are navigating from jdialog which can be any public property from a class whose value you will set when the button clicked and jdialog opened. – Usama Tahir Aug 27 '20 at 23:56
-
1Read the section from the Swing tutorial on [Changing the LAF After Startup](https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html#dynamic). – camickr Aug 28 '20 at 00:12