代号一 ActionListener 构建过程不起作用
Codename one ActionListener build process not working
我正在使用 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) 在 "Property Sheet" -> "Events" 视图中单击 "Action Event" 时出现此错误。
'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.
控制台 window 不过我觉得还不错
[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);
});
这是一个已在其他 IDE 中修复的错误,但似乎仍会影响 Eclipse。一旦负责的工程师可以召集它,我们将尝试发布 Eclipse 更新。
我正在使用 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) 在 "Property Sheet" -> "Events" 视图中单击 "Action Event" 时出现此错误。
'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.
控制台 window 不过我觉得还不错
[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);
});
这是一个已在其他 IDE 中修复的错误,但似乎仍会影响 Eclipse。一旦负责的工程师可以召集它,我们将尝试发布 Eclipse 更新。