Ecco un modo oper cambiare il LookAndFeel:
Questo metodo aggiorna il LookAndFeel del componente "component" dato come argomento del metodo updateComponentTreeUI(), e di conseguenza aggiorna il LookAndFeel di tutti i componenti contenuti nel component in quel momento,codice:protected void updateLookAndFeel(String source){ String plaf = null; if (source == "Metal") plaf = "javax.swing.plaf.metal.MetalLookAndFeel"; else if (source == "Windows") plaf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; else if (source == "Motif") plaf = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; try{ UIManager.setLookAndFeel(plaf); SwingUtilities.updateComponentTreeUI(component); }catch(Exception e){ System.out.println(e + "Something went wrong while updating the Look and Feel"); return; } }
ciao.

Rispondi quotando