Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 78551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:00:18+00:00 2026-05-10T21:00:18+00:00

I am using the following code to set a tray icon in Windows and

  • 0

I am using the following code to set a tray icon in Windows and Linux. It works wonderful in Windows and works okay in Linux. In Linux (Ubuntu) I have my panel set to be (somewhat) transparent and when I add a GIF (with a transparent background) the background of the icon shows up all grey and ugly (see image, green diamond ‘!’)….Any ideas on how to make the GIF image I am adding ‘keep’ its transparent background?

alt text http://unarm.org/stackoverflow/panel_task.jpg

and the image I am using, if you’d like to test:

alt text http://unarm.org/stackoverflow/green_info.gif

import java.awt.*; import java.awt.event.*;  public class TrayFun {     static class ShowMessageListener implements ActionListener {     TrayIcon trayIcon;     String title;     String message;     TrayIcon.MessageType messageType;     ShowMessageListener(         TrayIcon trayIcon,         String title,         String message,         TrayIcon.MessageType messageType) {       this.trayIcon = trayIcon;       this.title = title;       this.message = message;       this.messageType = messageType;     }     public void actionPerformed(ActionEvent e) {       trayIcon.displayMessage(title, message, messageType);     }   }    public static void main(String args[]) {     Runnable runner = new Runnable() {       public void run() {         if (SystemTray.isSupported()) {           final SystemTray tray = SystemTray.getSystemTray();           Image image = Toolkit.getDefaultToolkit().getImage('green_info.png');           PopupMenu popup = new PopupMenu();           final TrayIcon trayIcon = new TrayIcon(image, 'The Tip Text', popup);           trayIcon.setImageAutoSize(true);            MenuItem item = new MenuItem('Close');       item.addActionListener(new ActionListener() {             public void actionPerformed(ActionEvent e) {           tray.remove(trayIcon);             }       });           popup.add(item);           try {             tray.add(trayIcon);           } catch (AWTException e) {             System.err.println('Can't add to tray');           }         } else {           System.err.println('Tray unavailable');         }       }     };     EventQueue.invokeLater(runner);   } } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:00:19+00:00Added an answer on May 10, 2026 at 9:00 pm

    Chances are this problem cannot be resolved. It depends on wether Java is doing a good job in creating the tray subwindow in Linux or not. If Jave does it wrong, transparency is already lost when the image is drawn.

    1. What is the real background value of the icon you are using? Is it the gray tone shown above? Set it to purple to see if the transparency of the image is used (Java defaults to gray background) or not.

    2. Make sure you tried both transparency options of PNG: transparent color index as well as alpha channel. Alpha channel is very common in Linux, not so in the Windows world.

    3. The resolution of your icon is too small. Do it in 64×64 or better 128×128. AFAIK there is no standard resolution for tray icons, and even if so, it is certainly not 16×16.

    4. Another format you could try is SVG. Only try that after making sure that the transparency of the image is the problem (see 1).

    See here for background information on this issue: http://www.rasterman.com/index.php?page=News (scroll down to 2 February 2006)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 65k
  • Answers 65k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer As calling client side function is not possible I would… May 11, 2026 at 11:05 am
  • added an answer You can't remove items from a collection whilst you are… May 11, 2026 at 11:05 am
  • added an answer International Components for Unicode (ICU) does have the solutions you… May 11, 2026 at 11:05 am

Related Questions

I am using the following code to set a tray icon in Windows and
I am using the following code to check if a variable is not nil
I am using the following code to attempt to read a large file (280Mb)
Well I am using the following code to redirect users who don't have my
I am using the following generic code to save entities. using (ITransaction tx =
I am currently using the following code to create a web request: Dim myRequest
I am using the following code: <?php $stock = $_GET[s]; //returns stock ticker symbol
I am using the following code --- EDIT @annakata : Adding the complete code
I am using the following jquery code: $(#top ul li.corner).mouseover(function(){ $(span.left-corner).addClass(left-corner-hover); $(span.right-corner).addClass(right-corner-hover); $(span.content).addClass(content-hover); }).mouseout(function(){
I am using Windows CE 4.2 and MS Embedded VC++ 4.0. The following code

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.