Popup
is not a Swing component (therefore it's doesn't come under the control of the LookAndFeel manager).
The Popup
is an AWT component, which generally uses native components.
Instead, you should try something more like...
public void addToTray()
{
try
{
try {
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}
BufferedImage trayImg = ImageIO.read(new File("Geqo.png"));
ImageIcon ii = new ImageIcon(trayImg);
final TrayIcon trayIcon = new TrayIcon(ii.getImage(), "Geqo", null);
JPopupMenu jpopup = new JPopupMenu();
JMenuItem miExit = new JMenuItem("Exit");
jpopup.add(miExit);
miExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
SystemTray.getSystemTray().remove(trayIcon);
System.exit(0);
}
});
trayIcon.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) {
jpopup.setLocation(e.getX(), e.getY());
jpopup.setInvoker(jpopup);
jpopup.setVisible(true);
}
}
});
trayIcon.setImageAutoSize(true);
SystemTray.getSystemTray().add(trayIcon);
}
catch (Exception e)
{
e.printStackTrace();
}
}
This is based on the idea suggested in Using JPopupMneu
in TrayIcon