问题描述
我有一个应该,如果用户想继续与否(我的Android应用程序一个更大的任务的一部分),以提示摇篮任务。
我使用SwingBuilder来尝试构建一个对话,但我得到以下错误,当我尝试建立:
错误:(94)执行失败的任务:XXXXXX:问'。
>未找到工具包:apple.awt.CToolkit
显然,我没有安装在Mac上的东西,但我不知道我需要安装做。这是一个Java的依赖?或摇篮? (谷歌搜索这并不能帮助很大 - 唯一的相关链接是与谷歌的AppEngine不帮我多)。
下面的任务:
任务要求<< {
DEF通=''
新SwingBuilder(){EDT
对话框(模态:真实,
标题:继续,
alwaysOnTop:真实,
可调整大小:假的,
locationRelativeTo:空,
包:真的,
显示:真
){
VBOX {
标签(文字:你确定要继续吗?)
按钮(defaultButton:真,文本:继续,为actionPerformed:{
//做一点事
处置();
}) 按钮(defaultButton:真,文本:取消,为actionPerformed:{
//做一点事
处置(); //关闭对话框
})
}
}
}
根据,这个问题似乎是与IntelliJ IDEA的默认Java 6的运行的事实。你需要迫使它与Java 7上运行,而不是,如这个JetBrains的支持文章。
有一件事要记住的是,拥有的IntelliJ与Java 7及以上的Mac问题,这就是为什么它默认为Java 6.您可以在支持文章我联系了解详情。
I have a Gradle task that is supposed to prompt if the user wants to continue or not (part of a larger task for my Android app).
I'm using SwingBuilder to to try construct a dialog but I'm getting the following error when I try to build:
Error:(94) Execution failed for task ':XXXXXX:ask'.
> Toolkit not found: apple.awt.CToolkit
Obviously, I don't have something installed on my Mac but I'm not sure what I need to install. Is this a Java dependency? Or Gradle? (Googling this does not help very much either - the only relevant link is something to do with Google AppEngine which does not help me much).
Here's the task:
task ask << {
def pass = ''
new SwingBuilder().edt {
dialog(modal: true,
title: 'Continue',
alwaysOnTop: true,
resizable: false,
locationRelativeTo: null,
pack: true,
show: true
) {
vbox {
label(text: "Are you sure you want to continue?")
button(defaultButton: true, text: 'Continue', actionPerformed: {
//do something
dispose();
})
button(defaultButton: true, text: 'Cancel', actionPerformed: {
//do something
dispose(); // Close dialog
})
}
}
}
According to this issue on GitHub, the problem appears to be with the fact that IntelliJ IDEA runs on Java 6 by default. You'll need to force it to run with Java 7 instead, as described in this JetBrains support article.
One thing to bear in mind is that IntelliJ has problems with Java 7 and above on Mac, which is why it defaults to Java 6. You can find more details in that support article I linked to.
这篇关于摇篮SwingBuilder:QUOT&;工具包未发现:apple.awt.CToolkit&QUOT;错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!