【发布时间】:2017-04-17 14:48:22
【问题描述】:
我正在使用 codename one 构建我的第一个应用程序。
但是我认为在使用 eclipse 和新的 GUI Builder 时构建过程中存在错误。
我在 eclipse neon 上,本周刚安装了 cn1 插件。
1) 导致actionListeners不工作的主要原因是EventCallbackClass里面少了一行
public void actionPerformed(com.codename1.ui.events.ActionEvent ev) {
com.codename1.ui.Component sourceComponent = ev.getComponent();
if(sourceComponent.getParent().getLeadParent() != null) {
sourceComponent = sourceComponent.getParent().getLeadParent();
}
if(sourceComponent == gui_createAccount) {
--------------missing------------------
}
}
应该在其中调用 oncreateAccountActionEvent 方法,但它不在生成的代码中。
这可能是因为我在构建过程中遇到错误
2) 在“属性表”->“事件”视图中单击“操作事件”时出现此错误。
'Building workspace' has encountered a problem. Errors occured during the build.
Errors occurred during the build.
Errors running builder 'Integrated External Tool Builder' on project 'MA'.
Ant build C:\Users\sieben\workspace\MA\build.xml already in progress. Concurrent Ant builds are possible if you specify to build in a separate JRE.
Ant build C:\Users\sieben\workspace\MA\build.xml already in progress. Concurrent Ant builds are possible if you specify to build in a separate JRE.
控制台窗口对我来说看起来不错
[echo] Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller
[echo] code size and wider device support
[javac] C:\Users\sieben\workspace\MA\build.xml:147: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] C:\Users\sieben\workspace\MA\build.xml:171: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
Buildfile: C:\Users\sieben\workspace\MA\build.xml
jar:
[copy] Copying 1 file to C:\Users\sieben\workspace\MA\build\tmp
[javac] Compiling 4 source files to C:\Users\sieben\workspace\MA\build\tmp
[jar] Building jar: C:\Users\sieben\workspace\MA\dist\MA.jar
BUILD SUCCESSFUL
Total time: 1 second
感谢您的建议,也许我必须重新开始......
编辑 - 解决方法:
在构造函数中指定动作事件监听方法,如下所示:
gui_createAccount.addActionListener((ev) -> {
oncreateAccountActionEvent(ev);
});
【问题讨论】:
-
我添加了一个变通方法,以使代码在修复可用之前保持工作。
标签: eclipse build ide codenameone