我正在玩 - 我的第一个SWT应用程序。 当我打包我的eclipse SWT表java应用程序,Mac OS X 10.6.8时,方法返回值为0.如果我删除.app并执行应用程序可执行文件,它工作正常。它在日食中工作正常。它在Windows 7中工作正常。我的“调试”消息框始终包含正确的值。如果我对表clientHeight,headerHeight和itemHeight进行硬编码,则返回值是正确的。
private int adjustItemsNEEDED(Table tTable) {
int itemsNeeded = 0;
int clientHeight = tTable.getClientArea().height;
int headerHeight = tTable.getHeaderHeight();
int itemHeight = tTable.getItemHeight();
if (itemHeight != 0) {
itemsNeeded = (clientHeight - headerHeight) / itemHeight;
} else {
itemsNeeded = 0;
}
messageTextBoxTop.setText("height=" + clientHeight + " header=" + headerHeight + " item=" + itemHeight + " needed=" + itemsNeeded);
return itemsNeeded;
}
我的可执行文件:
#!/bin/sh
BASEDIR=`dirname $0`
exec java \
-d64 \
-XstartOnFirstThread \
-classpath $BASEDIR/org.eclipse.SWT.cocoa.macosx.x64/swt.jar:$BASEDIR \
-Djava.library.path=$BASEDIR/org.eclipse.SWT.cocoa.macosx.x64 \
MyApp
我的info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>CheckBook</string>
<key>CFBundleGetInfoString</key>
<string>SWTHello 1.0 for Mac OS X</string>
<key>CFBundleIconFile</key>
<string>CheckBook.icns</string>
<key>CFBundleIdentifier</key>
<string>org.eclipse.swt.HelloWorldSWTApplication</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>CheckBook</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>?????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>