So far I have this
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(\"com.sun.java.swing.plaf.nimbus.NimbusLookAndFee
I know I am late but I think someone might be use this it is kind of hack that I use to put multi look and feel to the app: put this the look and feel chooser before initiating the item (before writing = new ...)
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
| UnsupportedLookAndFeelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
and then return the UIManager look and feel to the look and feel that it was on before you do this after it as in the example below:
JButton test;
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
| UnsupportedLookAndFeelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
test = new JButton();
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Mwtal".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
| UnsupportedLookAndFeelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Like this only the button test will have the look and feel of the windows and the rest will have look and feel of Metal.
Hope this hack help someone.
When a Component is created, the current LookAndFeel will be used to display that Component
.
I've done it. You have to create parts of the UI, and then call UIManager.setLookAndFeel() to change the look & feel, and then create the other parts. It's more like a hack.