我有一个 Gradle 任务,它应该提示用户是否要继续(我的 Android 应用程序的更大任务的一部分)。
我正在使用 SwingBuilder 尝试构建对话框,但在尝试构建时出现以下错误:
Error:(94) Execution failed for task ':XXXXXX:ask'.
> Toolkit not found: apple.awt.CToolkit
显然,我的 Mac 上没有安装任何东西,但我不确定我需要安装什么。这是Java依赖吗?还是摇篮?(谷歌搜索也无济于事——唯一相关的链接与 Google AppEngine 有关,对我没有多大帮助)。
这是任务:
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
})
}
}
}