In respect to MacOSX Look & feel, change the systray icon when systray menu appears.

Systray MacOSX icons contributed by Guillaume Schreiner.
Fixed some wrong code identation.
cusax-fix
Romain Kuntz 19 years ago
parent 16731726f4
commit 519953223f

@ -12,6 +12,7 @@
import java.util.Timer;
import javax.swing.*;
import javax.swing.event.*;
import net.java.sip.communicator.impl.systray.*;
import net.java.sip.communicator.service.configuration.*;
@ -79,6 +80,7 @@ public class SystrayServiceJdicImpl
* The various icons used on the systray
*/
private ImageIcon logoIcon;
private ImageIcon logoIconWhite;
private ImageIcon envelopeIcon;
/**
@ -117,26 +119,28 @@ private void initSystray()
// background.
if (osName.startsWith("Windows"))
{
logoIcon = new ImageIcon(
Resources.getImage("trayIconWindows"));
envelopeIcon = new ImageIcon(
Resources.getImage("messageIconWindows"));
logoIcon = new ImageIcon(
Resources.getImage("trayIconWindows"));
envelopeIcon = new ImageIcon(
Resources.getImage("messageIconWindows"));
}
// If we're running under MacOSX, we use a special back and
// white icons without background.
else if (osName.startsWith("Mac OS X"))
{
logoIcon = new ImageIcon(
Resources.getImage("trayIconMacOSX"));
envelopeIcon = new ImageIcon(
Resources.getImage("messageIconMacOSX"));
logoIcon = new ImageIcon(
Resources.getImage("trayIconMacOSX"));
logoIconWhite = new ImageIcon(
Resources.getImage("trayIconMacOSXWhite"));
envelopeIcon = new ImageIcon(
Resources.getImage("messageIconMacOSX"));
}
else
{
logoIcon = new ImageIcon(
logoIcon = new ImageIcon(
Resources.getImage("trayIcon"));
envelopeIcon = new ImageIcon(
Resources.getImage("messageIcon"));
envelopeIcon = new ImageIcon(
Resources.getImage("messageIcon"));
}
trayIcon = new TrayIcon(logoIcon, "SIP Communicator", menu);
@ -164,6 +168,29 @@ public void actionPerformed(ActionEvent e)
}
});
// Change the MacOSX icon with the white one when the popup
// menu appears
if (osName.startsWith("Mac OS X"))
{
menu.addPopupMenuListener(new PopupMenuListener()
{
public void popupMenuWillBecomeVisible(PopupMenuEvent e)
{
trayIcon.setIcon(logoIconWhite);
}
public void popupMenuWillBecomeInvisible(PopupMenuEvent e)
{
trayIcon.setIcon(logoIcon);
}
public void popupMenuCanceled(PopupMenuEvent e)
{
trayIcon.setIcon(logoIconWhite);
}
});
}
//Notify all interested listener that user has clicked on the systray
//popup message.
trayIcon.addBalloonActionListener(new ActionListener()

@ -7,6 +7,7 @@ trayIcon=net/java/sip/communicator/impl/systray/resources/systrayIcon.png
trayIconWindows=net/java/sip/communicator/impl/systray/resources/systrayIconWindows.png
trayIconWindowsAnimated=net/java/sip/communicator/impl/systray/resources/systrayIconWindows.gif
trayIconMacOSX=net/java/sip/communicator/impl/systray/resources/systrayIconMacOSX.png
trayIconMacOSXWhite=net/java/sip/communicator/impl/systray/resources/systrayIconMacOSXWhite.png
addContactIcon=net/java/sip/communicator/impl/systray/resources/addContactIcon.png
statusMenuIcon=net/java/sip/communicator/impl/systray/resources/statusIcon.png
settingsMenuIcon=net/java/sip/communicator/impl/systray/resources/configureIcon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 B

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

@ -9,6 +9,7 @@ trayIcon=net/java/sip/communicator/impl/systray/resources/systrayIcon.png
trayIconWindows=net/java/sip/communicator/impl/systray/resources/systrayIconWindows.png
trayIconWindowsAnimated=net/java/sip/communicator/impl/systray/resources/systrayIconWindows.gif
trayIconMacOSX=net/java/sip/communicator/impl/systray/resources/systrayIconMacOSX.png
trayIconMacOSXWhite=net/java/sip/communicator/impl/systray/resources/systrayIconMacOSXWhite.png
addContactIcon=net/java/sip/communicator/impl/systray/resources/addContactIcon.png
statusMenuIcon=net/java/sip/communicator/impl/systray/resources/statusIcon.png
settingsMenuIcon=net/java/sip/communicator/impl/systray/resources/configureIcon.png

Loading…
Cancel
Save