-1
當我試圖在lwuit表單上顯示對話框提醒時,我收到了一個奇怪的異常。在lwuit表單中顯示多行消息的提醒
java.lang.NullPointerException
at com.sun.lwuit.TextArea.shouldShowHint(+21)
at com.sun.lwuit.TextArea.calcPreferredSize(+4)
at com.sun.lwuit.Component.preferredSize(+63)
at com.sun.lwuit.Component.getPreferredSize(+4)
at com.sun.lwuit.Component.getPreferredW(+4)
at com.sun.lwuit.layouts.FlowLayout.layoutContainer(+139)
at com.sun.lwuit.Container.doLayout(+8)
at com.sun.lwuit.Container.layoutContainer(+16)
at com.sun.lwuit.Container.doLayout(+40)
at com.sun.lwuit.Container.layoutContainer(+16)
at com.sun.lwuit.Container.doLayout(+40)
at com.sun.lwuit.Container.layoutContainer(+16)
at com.sun.lwuit.Container.revalidate(+18)
at com.sun.lwuit.Dialog.showPacked(+107)
at com.sun.lwuit.Dialog.showImpl(+76)
at com.sun.lwuit.Dialog.show(+5)
at com.sun.lwuit.Dialog.showDialog(+9)
at com.test.MainView.ShowAlert(+82)
at com.test.MainView.ShowGameOverAlert(+45)
at com.test.MainView.<init>(+209)
at com.test.Main.startApp(+29)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
我用以下兩件代碼:
Dialog validDialog = new Dialog("Alert");
validDialog.setScrollable(false);
validDialog.setIsScrollVisible(false);
validDialog.setTimeout(5000); // set timeout milliseconds
TextArea textArea = new TextArea("...."); //pass the alert text here
textArea.setFocusable(false);
textArea.setIsScrollVisible(false);
validDialog.addComponent(textArea);
validDialog.show(0, 100, 10, 10, true);
和
Dialog d = new Dialog(title);
TextArea l = new TextArea(1, 20);
l.setText(message);
l.setHint("no hint");
l.setSingleLineTextArea(false);
l.setEditable(false);
l.setGrowByContent(true);
d.addComponent(l);
d.setDialogType(Dialog.TYPE_INFO);
d.setDialogPosition(BorderLayout.CENTER);
d.showDialog();
如果有人能指出我LWUIT的源代碼,它將是最有幫助的。
我發現一個名爲lwuitfixes的項目在google代碼上沒有任何函數'shouldShowHint'裏面的TextArea.java和官方網站https://lwuit-incubator.dev.java.net/永遠不會打開!!!!!!!
LWUIT孵化器不是官方網站。甲骨文轉移了網站去除dev這個詞。它的lwuit.java.net。 – 2013-03-24 19:42:36
@ShaiAlmog [lwuit.java.net](lwuit.java.net)仍然在標題爲「如何貢獻?」下顯示上述鏈接的鏈接。如果可用,請分享鏈接以下載LWUIT的來源。 – 2013-03-25 08:38:34
在LWUIT項目頁面中曾經有一個SVN鏈接,但Oracle成員似乎完全打破了這個項目。訪問源代碼似乎不再有效。典型。唯一的來源是Codename One。 – 2013-03-25 12:25:08