我在SWT可可源中發現了這個問題。
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);
}
的問題是其只需要像純尺寸(在你的情況下,它是128像素)的行width = image.handle.size().width + BORDER;
。我沒有找到任何合適的解決方法(我看到你發佈SWT bugzilla的bug報告)。
所以只有這樣才能避免這個錯誤(現在)是讓你的托盤圖像變小。
沒有任何代碼,這將很難調試。基於一些谷歌搜索,看起來你應該能夠做到這一點,沒有任何問題。 – jtbandes
您是否嘗試過在eclipse.platform.swt上提問並搜索https://bugs.eclipse.org/bugs/以查找可能的錯誤? –
SWT片段143如何 - http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.java?view=co - look爲你? –