首页 > 文档 > selectOutput()选择输出
2017
08-02

selectOutput()选择输出

Name

selectOutput()选择输出

   

Examples

void setup() {

selectOutput(“Select a file to write to:”, “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 output. 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

selectOutput(prompt, callback)

selectOutput(prompt, callback, file)

selectOutput(prompt, callback, file, callbackObject)

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

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

Parameters

prompt

String: message to the user

提示字符串: 向用户发送消息

callback

String: name of the method to be called when the selection is made

回调字符串: 进行选择时要调用的方法的名称

Returns

void



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

留下一个回复

你的email不会被公开。