1

我在玩——我的第一个 SWT 应用程序。当我打包我的eclipse SWT Table java应用程序Mac OS X 10.6.8时,方法返回值为0。如果我删除.app并执行应用程序可执行文件,它可以正常工作。它在日食中工作正常。它在 Windows 7 中运行良好。我的“调试”消息框总是包含正确的值。如果我对 Table 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>
4

0 回答 0