我尝试将 LWUIT 添加Form
到另一个 LWUITForm
中,但在运行时收到内部错误:
Installing suite from: http://127.0.0.1:1975/SmartPhoneBanking.jad
java.lang.IllegalArgumentException: A form cannot be added to a container
- com.sun.lwuit.Container.insertComponentAt(), bci=50
- com.sun.lwuit.Container.addComponent(), bci=19
- com.sun.lwuit.Form.addComponent(), bci=5
- view.test.<init>(), bci=63
- view.MenuPrincipalForm.actionPerformed(), bci=178
- com.sun.lwuit.util.EventDispatcher.fireActionSync(), bci=19
- com.sun.lwuit.util.EventDispatcher.fireActionEvent(), bci=89
- com.sun.lwuit.Button.fireActionEvent(), bci=70
- com.sun.lwuit.Button.released(), bci=17
- com.sun.lwuit.Button.pointerReleased(), bci=1
- com.sun.lwuit.Form.pointerReleased(), bci=93
- com.sun.lwuit.Component.pointerReleased(), bci=7
- com.sun.lwuit.Display.handleEvent(), bci=125
- com.sun.lwuit.Display.edtLoopImpl(), bci=115
- com.sun.lwuit.Display.mainEDTLoop(), bci=198
- com.sun.lwuit.RunnableWrapper.run(), bci=242
- java.lang.Thread.run(), bci=11
Process exited with exit code 0
虽然 LWUITForm
是 LWUIT Component
!所以 addComponent 应该与 LWUIT 一起使用Form
!
那么如何使它成为可能呢?
代码:
public class test extends Form
{
private Button b = new Button("xxx");
public test(String t)
{
super(t);
addComponent(b);
}
}
在另一个Form
:
...
private Form xxx = new test("xxx");
...
addComponent(xxx);
...