首页 > 文档 > selectInput()选择输入
2017
07-14

selectInput()选择输入

3-15.selectInput()

Name(名称):

Examples(例子):

void setup() {

selectInput(“Select a file to process:”, “fileSelected”);

}

 

void fileSelected(File selection) {

if (selection == null) {

println(“Window was closed or the user hit cancel.”);

} else {

println(“User selected ” + selection.getAbsolutePath());

}

}

Description(描述):Opens a platform-specific file chooser dialog to select a file for input. After the selection is made, the selected File will be passed to the ‘callback’ function. If the dialog is closed or canceled, null will be sent to the function, so that the program is not waiting for additional input. The callback is necessary because of how threading works.


打开特定于平台的文件选择器对话框,以选择要输入的文件。 选择后,所选文件将被传递到”回调”功能。 如果对话框关闭或取消,将会将null发送到该函数,以便程序不等待其他输入。 回调是必要的,因为线程如何工作。

Syntax(语法):

selectInput(prompt, callback)

selectInput(prompt, callback, file)

selectInput(prompt, callback, file, callbackObject)

selectInput(prompt, callbackMethod, file, callbackObject, parent, sketch)

selectInput(prompt, callbackMethod, file, callbackObject, parent)

Parameters (参数):prompt——message to the user消息给用户

Callback——name of the method to be called when the selection is made在进行选择时要调用的方法的名称

 

Returns(返回值):Void(



最后编辑:
作者:卡萨布兰卡
卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。