public void addToMenu ( final JMenu menu ) { final UIManager . LookAndFeelInfo [ ] plafInfo = UIManager . getInstalledLookAndFeels ( ) ; for ( UIManager . LookAndFeelInfo aPlafInfo : plafInfo ) { addToMenu ( aPlafInfo . getName ( ) , aPlafInfo . getClassName ( ) , menu ) ; } final LookAndFeel current = UIManager . getLookAndFeel ( ) ; System . out . printf ( "current L&F=%s%n" , current . getName ( ) ) ; }
Add a set of MenuItems to the given JMenu one for each possible L&F . if this platform doesnt support the L&F disable the MenuItem .