Interface TinyFdApi
public interface TinyFdApi
API for TinyFD, a cross-platform file selection dialog.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic TinyFdApi@Nullable PathopenFileSelector(@Nullable String title, @Nullable String defaultFilePath, String[] filterPatterns, @Nullable String filterDescription) Open a file selection prompt.openFolderSelector(@Nullable String title, @Nullable String defaultFolderPath) Open a folder selection prompt.Path[]openMultiFileSelector(@Nullable String title, @Nullable String defaultFilePath, String[] filterPatterns, @Nullable String filterDescription) Open a multi file selection prompt.openSaveSelector(@Nullable String title, @Nullable String defaultFilePath, String[] filterPatterns, @Nullable String filterDescription) Open a save file selection prompt.booleanshowMessageBox(String title, String message, @NotNull String dialog, String icon, boolean defaultValue) Shows a message box.intshowNotification(String title, String message, String icon) Shows a notification.
-
Field Details
-
QUESTION_ICON
- See Also:
-
ERROR_ICON
- See Also:
-
WARNING_ICON
- See Also:
-
INFO_ICON
- See Also:
-
OK_DIALOG
- See Also:
-
OK_CANCEL_DIALOG
- See Also:
-
YES_NO_DIALOG
- See Also:
-
YES_NO_CANCEL_DIALOG
- See Also:
-
-
Method Details
-
getInstance
-
openSaveSelector
Path openSaveSelector(@Nullable @Nullable String title, @Nullable @Nullable String defaultFilePath, String[] filterPatterns, @Nullable @Nullable String filterDescription) Open a save file selection prompt. Same asopenFileSelector(String, String, String[], String)but says save instead of open. -
openFileSelector
@Nullable @Nullable Path openFileSelector(@Nullable @Nullable String title, @Nullable @Nullable String defaultFilePath, String[] filterPatterns, @Nullable @Nullable String filterDescription) Open a file selection prompt.- Parameters:
title- the title of the promptdefaultFilePath- the path to the default file to selectfilterPatterns- the file extensions to filter by. e.g. new String[]{"*.png", "*.jpg"}filterDescription- the description for said filter. e.g. "Images"- Returns:
- the selected file, or null if the user cancelled.
-
openMultiFileSelector
Path[] openMultiFileSelector(@Nullable @Nullable String title, @Nullable @Nullable String defaultFilePath, String[] filterPatterns, @Nullable @Nullable String filterDescription) Open a multi file selection prompt. Same asopenFileSelector(String, String, String[], String)but allows the user to select multiple files. -
openFolderSelector
Path openFolderSelector(@Nullable @Nullable String title, @Nullable @Nullable String defaultFolderPath) Open a folder selection prompt. Same asopenFileSelector(String, String, String[], String)but allows the user to select a folder. -
showMessageBox
boolean showMessageBox(String title, String message, @NotNull @NotNull String dialog, String icon, boolean defaultValue) Shows a message box.- Parameters:
message- the message. may contain \n and \tdialog- the type of message box to show.
One of:OK_DIALOG,OK_CANCEL_DIALOG,YES_NO_DIALOG,YES_NO_CANCEL_DIALOGicon- the icon to use.
One of:QUESTION_ICON,ERROR_ICON,WARNING_ICON,INFO_ICONdefaultValue- the default value to return if the user closes the dialog without clicking a button- Returns:
- true if the user clicked the "ok" or "yes" button, false for "cancel" or "no"
-
showNotification
Shows a notification.- Parameters:
icon- the icon to use. One of:QUESTION_ICON,ERROR_ICON,WARNING_ICON,INFO_ICON- Returns:
- 0 if the user clicked the "ok" button, 1 for "cancel"
-