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 6103325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:42:58+00:00 2026-05-23T13:42:58+00:00

On my cross-platform SWT Java application, I’m using TrayItem’s setImages() function to set the

  • 0

On my cross-platform SWT Java application, I’m using TrayItem’s setImages() function to set the dock and status bar icon. The icon is a 128×128 transparent PNG. The status and tray icons are appropriately clipped on both Windows and Linux distributions, but on the Mac I have problems that make the status bar icon appear with strange padding on both sides like this:

It’s strange to me that this is working on all other platforms but the Mac. For instance, here is the same status bar icon without the problem on my Linux box:

Does anyone have any idea how to prevent this extra padding on the Mac?

  • 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. Editorial Team
    Editorial Team
    2026-05-23T13:42:58+00:00Added an answer on May 23, 2026 at 1:42 pm

    I found the problem in SWT Cocoa sources.

    public void setImage (Image image) {
        checkWidget ();
        if (image != null && image.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
        super.setImage (image);
        double /*float*/ width = 0;
        if (image == null) {
            view.setImage (null);
        } else {
            /*
             * Feature in Cocoa.  If the NSImage object being set into the view is
             * the same NSImage object that is already there then the new image is
             * not taken.  This results in the view's image not changing even if the
             * NSImage object's content has changed since it was last set into the
             * view.  The workaround is to temporarily set the view's image to null
             * so that the new image will then be taken.
             */
            NSImage current = view.image ();
            if (current != null && current.id == image.handle.id) {
                view.setImage (null);
            }
            view.setImage (image.handle);
            if (visible) {
                width = image.handle.size ().width + BORDER;
            }
        }
        item.setLength (width);
    }
    

    The problem is on the line width = image.handle.size ().width + BORDER; which just takes pure size of image (in your case it’s 128 px). I didn’t found any suitable workaround (I saw you post bug report on SWT bugzilla).

    So only way to avoid this bug (for now) is to make your tray image smaller.

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

Sidebar

Related Questions

The last cross platform desktop development I did was Java/Swing. What about flex?
When architecting a cross platform C# application (IE: planning on creating a mono version)
i've developed an cross-platform AIR application, which seriously under performs on mobile devices caused
I'm developing some cross platform software targeting Mono under Visual Studio and would like
Is there a (cross-platform) way to get a C FILE* handle from a C++
What is the easiest cross platform widget toolkit? I'm looking for one that minimally
I have a cross platform program that runs on Windows, Linux and Macintosh. My
Is there some reasonably cross platform way to create a thumbnail image given a
I need a cross platform method of determining the MAC address of a computer
I'm writing some cross-platform code between Windows and Mac. If list::end() "returns an iterator

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.