try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
{
if ("Windows".equals(info.getName()))
{
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
}catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
Logger.getLogger(WizardForm.class.getName()).log(Level.SEVERE, null, ex);
}
You can change the part shown in bold (Windows) to Nimbus, Metal, Motif, System, GTK etc. YOu can change the Look and Feel (LookAndFeel) of your java application simply by changing the text shown bold into above specified names of Look and Feels. To set to Nimbus Look And Feel, replace 'Windows' in the code with 'Nimbus'. Similarly you can apply Metal, Motif, System or GTK as your application's Look and Feel. You can also install third party look and feels by adding their library jar file into your app.
No comments:
Post a Comment