I have the following code to create a TrayIcon with a PopupMenu :
public void addToTray()
{
try
{
try {
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}
PopupMenu popMenu= new PopupMenu();
MenuItem exititem = new MenuItem("Exit");
popMenu.add(exititem);
BufferedImage trayImg = ImageIO.read(new File("Geqo.png"));
ImageIcon ii = new ImageIcon(trayImg);
TrayIcon trayIcon = new TrayIcon(ii.getImage(), "Geqo", popMenu);
trayIcon.setImageAutoSize(true);
SystemTray.getSystemTray().add(trayIcon);
}
catch (Exception e)
{
e.printStackTrace();
}
}
This code is meant to create a TrayIcon with a PopupMenu. This works fine. But I did'nt like the default LAF (Metal, I think). So I tried to change the LAF to nimbus, as well as the OS Default, Windows, but to no avail. The LAF doesn't seem to be changing. Can anyone hguide me on how I chould change the LAF? Thanks in advance :)!!