Top Description Fields Constructors Methods
org.lwjgl.util.tinyfd

public Class TinyFileDialogs

extends Object
Class Inheritance
Imports
javax.annotation.*, java.nio.*, org.lwjgl.*, org.lwjgl.system.*

Bindings to tiny file dialogs, a native dialog library with support for:

The dialogs can be forced into console mode.

Field Summary

Modifier and TypeField and Description
public static final String
tinyfd_allowCursesDialogs

Curses dialogs are difficult to use, on windows they are only ascii and uses the unix backslash

public static final String
tinyfd_assumeGraphicDisplay

0 (default) or 1.

public static final String
tinyfd_forceConsole

0 (default) or 1.

public static final String
tinyfd_needs

Contains info about requirements.

public static final String
tinyfd_response

If you pass "tinyfd_query" as aTitle, the functions will not display the dialogs but will fill tinyfd_response with the retain solution and return 0 for console mode, 1 for graphic mode.

public static final String
tinyfd_silent

1 (default) or 0 : on unix, hide errors and warnings from called dialogs

public static final String
tinyfd_verbose

0 (default) or 1 : on unix, prints the command line calls

public static final String
tinyfd_version

Contains tinyfd current version number.

public static final String
tinyfd_winUtf8

On windows, set to 1 if you want to use UTF-8.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static native long
ntinyfd_colorChooser(long aTitle, long aDefaultHexRGB, long aDefaultRGB, long aoResultRGB)

Unsafe version of: colorChooser

public static native long
ntinyfd_getGlobalChar(long aCharVariableName)

Unsafe version of: getGlobalChar

public static native int
ntinyfd_getGlobalInt(long aIntVariableName)

Unsafe version of: getGlobalInt

public static native long
ntinyfd_inputBox(long aTitle, long aMessage, long aDefaultInput)

Unsafe version of: inputBox

public static native int
ntinyfd_messageBox(long aTitle, long aMessage, long aDialogType, long aIconType, int aDefaultButton)

Unsafe version of: messageBox

public static native int
ntinyfd_notifyPopup(long aTitle, long aMessage, long aIconType)

Unsafe version of: notifyPopup

public static native long
ntinyfd_openFileDialog(long aTitle, long aDefaultPathAndFile, int
the number of patterns in aFilterPatterns
aNumOfFilterPatterns
,
long aFilterPatterns, long aSingleFilterDescription, int aAllowMultipleSelects)

Unsafe version of: openFileDialog

public static native long
ntinyfd_saveFileDialog(long aTitle, long aDefaultPathAndFile, int
the number of patterns in aFilterPatterns
aNumOfFilterPatterns
,
long aFilterPatterns, long aSingleFilterDescription)

Unsafe version of: saveFileDialog

public static native long
ntinyfd_selectFolderDialog(long aTitle, long aDefaultPath)

Unsafe version of: selectFolderDialog

public static native int
ntinyfd_setGlobalInt(long aIntVariableName, int aValue)

Unsafe version of: setGlobalInt

public static native void
public static String

Returns:

the selected hexcolor as a string "#FF0000" or NULL on cancel
tinyfd_colorChooser
(ByteBuffer
the dialog title or NULL
aTitle
,
ByteBuffer
NULL or "#FF0000"
aDefaultHexRGB
,
ByteBuffer
{ 0 , 255 , 255 }. Used only if aDefaultHexRGB is NULL.
aDefaultRGB
,
ByteBuffer
returns the selected color. aDefaultRGB and aoResultRGB can be the same array.
aoResultRGB
)

Displays a color chooser dialog.

public static String

Returns:

the selected hexcolor as a string "#FF0000" or NULL on cancel
tinyfd_colorChooser
(CharSequence
the dialog title or NULL
aTitle
,
CharSequence
NULL or "#FF0000"
aDefaultHexRGB
,
ByteBuffer
{ 0 , 255 , 255 }. Used only if aDefaultHexRGB is NULL.
aDefaultRGB
,
ByteBuffer
returns the selected color. aDefaultRGB and aoResultRGB can be the same array.
aoResultRGB
)

Displays a color chooser dialog.

public static String

Returns:

NULL on error
tinyfd_getGlobalChar
(ByteBuffer aCharVariableName)

public static String

Returns:

NULL on error
tinyfd_getGlobalChar
(CharSequence aCharVariableName)

public static int
public static int
public static String

Returns:

the input value or NULL on cancel
tinyfd_inputBox
(ByteBuffer
the dialog title or NULL
aTitle
,
ByteBuffer
the message or NULL. May NOT contain \n and \t characters on Windows.
aMessage
,
ByteBuffer
if NULL it's a password box
aDefaultInput
)

Displays an input dialog.

public static String

Returns:

the input value or NULL on cancel
tinyfd_inputBox
(CharSequence
the dialog title or NULL
aTitle
,
CharSequence
the message or NULL. May NOT contain \n and \t characters on Windows.
aMessage
,
CharSequence
if NULL it's a password box
aDefaultInput
)

Displays an input dialog.

public static boolean

Returns:

0 for cancel/no, 1 for ok/yes, 2 for no in yesnocancel
tinyfd_messageBox
(ByteBuffer
the dialog title or NULL
aTitle
,
ByteBuffer
the message or NULL. It may contain \n and \t characters.
aMessage
,
ByteBuffer
the dialog type. One of:
"ok""okcancel""yesno""yesnocancel"
aDialogType
,
ByteBuffer
the icon type. One of:
"info""warning""error""question"
aIconType
,
boolean
0 for cancel/no, 1 for ok/yes
aDefaultButton
)

Displays a message dialog.

public static boolean

Returns:

0 for cancel/no, 1 for ok/yes, 2 for no in yesnocancel
tinyfd_messageBox
(CharSequence
the dialog title or NULL
aTitle
,
CharSequence
the message or NULL. It may contain \n and \t characters.
aMessage
,
CharSequence
the dialog type. One of:
"ok""okcancel""yesno""yesnocancel"
aDialogType
,
CharSequence
the icon type. One of:
"info""warning""error""question"
aIconType
,
boolean
0 for cancel/no, 1 for ok/yes
aDefaultButton
)

Displays a message dialog.

public static int
tinyfd_notifyPopup(ByteBuffer
the dialog title or NULL
aTitle
,
ByteBuffer
the message or NULL. It may contain \n and \t characters.
aMessage
,
ByteBuffer
the icon type. One of:
"info""warning""error"
aIconType
)

Displays a notification popup.

public static int
tinyfd_notifyPopup(CharSequence
the dialog title or NULL
aTitle
,
CharSequence
the message or NULL. It may contain \n and \t characters.
aMessage
,
CharSequence
the icon type. One of:
"info""warning""error"
aIconType
)

Displays a notification popup.

public static String

Returns:

the file(s) selected or NULL on cancel. In case of multiple files, the separator is '|'.
tinyfd_openFileDialog
(ByteBuffer
the dialog title or NULL
aTitle
,
ByteBuffer
the default path and/or file or NULL
aDefaultPathAndFile
,
PointerBuffer
an array of file type patterns (NULL or {"*.jpg","*.png"}
aFilterPatterns
,
ByteBuffer
NULL or "image files"
aSingleFilterDescription
,
boolean
if true, multiple selections are allowed
aAllowMultipleSelects
)

Displays a file open dialog.

public static String

Returns:

the file(s) selected or NULL on cancel. In case of multiple files, the separator is '|'.
tinyfd_openFileDialog
(CharSequence
the dialog title or NULL
aTitle
,
CharSequence
the default path and/or file or NULL
aDefaultPathAndFile
,
PointerBuffer
an array of file type patterns (NULL or {"*.jpg","*.png"}
aFilterPatterns
,
CharSequence
NULL or "image files"
aSingleFilterDescription
,
boolean
if true, multiple selections are allowed
aAllowMultipleSelects
)

Displays a file open dialog.

public static String

Returns:

the selected file path or NULL on cancel
tinyfd_saveFileDialog
(ByteBuffer
the dialog title or NULL
aTitle
,
ByteBuffer
the default path and/or file or NULL
aDefaultPathAndFile
,
PointerBuffer
an array of file type patterns (NULL or {"*.jpg","*.png"}
aFilterPatterns
,
ByteBuffer
NULL or "image files"
aSingleFilterDescription
)

Displays a file save dialog.

public static String

Returns:

the selected file path or NULL on cancel
tinyfd_saveFileDialog
(CharSequence
the dialog title or NULL
aTitle
,
CharSequence
the default path and/or file or NULL
aDefaultPathAndFile
,
PointerBuffer
an array of file type patterns (NULL or {"*.jpg","*.png"}
aFilterPatterns
,
CharSequence
NULL or "image files"
aSingleFilterDescription
)

Displays a file save dialog.

public static String
tinyfd_selectFolderDialog(ByteBuffer
the dialog title or NULL
aTitle
,
ByteBuffer
the default path or NULL
aDefaultPath
)

Displays a folder selection dialog.

public static String
tinyfd_selectFolderDialog(CharSequence
the dialog title or NULL
aTitle
,
CharSequence
the default path or NULL
aDefaultPath
)

Displays a folder selection dialog.

public static int
public static int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

tinyfd_allowCursesDialogsback to summary
public static final String tinyfd_allowCursesDialogs

Curses dialogs are difficult to use, on windows they are only ascii and uses the unix backslash

tinyfd_assumeGraphicDisplayback to summary
public static final String tinyfd_assumeGraphicDisplay

0 (default) or 1.

Some systems don't set the environment variable DISPLAY even when a graphic display is present. Set this to 1 to tell tinyfiledialogs to assume the existence of a graphic display.

tinyfd_forceConsoleback to summary
public static final String tinyfd_forceConsole

0 (default) or 1. For unix & windows: 0 (graphic mode) or 1 (console mode).

0: try to use a graphic solution, if it fails then it uses console mode.

1: forces all dialogs into console mode even when an X server is present, it can use the package dialog or dialog.exe. On windows it only make sense for console applications

tinyfd_needsback to summary
public static final String tinyfd_needs

Contains info about requirements.

tinyfd_responseback to summary
public static final String tinyfd_response

If you pass "tinyfd_query" as aTitle, the functions will not display the dialogs but will fill tinyfd_response with the retain solution and return 0 for console mode, 1 for graphic mode.

Possible values for tinyfd_response are (all lowercase) for the graphic mode:


windows_wchar windows applescript kdialog zenity zenity3 matedialog
shellementary qarma yad python2-tkinter python3-tkinter python-dbus
perl-dbus gxmessage gmessage xmessage xdialog gdialog

For the console mode:


dialog whiptail basicinput no_solution
tinyfd_silentback to summary
public static final String tinyfd_silent

1 (default) or 0 : on unix, hide errors and warnings from called dialogs

tinyfd_verboseback to summary
public static final String tinyfd_verbose

0 (default) or 1 : on unix, prints the command line calls

tinyfd_versionback to summary
public static final String tinyfd_version

Contains tinyfd current version number.

tinyfd_winUtf8back to summary
public static final String tinyfd_winUtf8

On windows, set to 1 if you want to use UTF-8.

LWJGL note: this is automatically set to 1.

Constructor Detail

TinyFileDialogsback to summary
protected TinyFileDialogs()

Method Detail

ntinyfd_colorChooserback to summary
public static native long ntinyfd_colorChooser(long aTitle, long aDefaultHexRGB, long aDefaultRGB, long aoResultRGB)

Unsafe version of: colorChooser

ntinyfd_getGlobalCharback to summary
public static native long ntinyfd_getGlobalChar(long aCharVariableName)

Unsafe version of: getGlobalChar

ntinyfd_getGlobalIntback to summary
public static native int ntinyfd_getGlobalInt(long aIntVariableName)

Unsafe version of: getGlobalInt

ntinyfd_inputBoxback to summary
public static native long ntinyfd_inputBox(long aTitle, long aMessage, long aDefaultInput)

Unsafe version of: inputBox

ntinyfd_messageBoxback to summary
public static native int ntinyfd_messageBox(long aTitle, long aMessage, long aDialogType, long aIconType, int aDefaultButton)

Unsafe version of: messageBox

ntinyfd_notifyPopupback to summary
public static native int ntinyfd_notifyPopup(long aTitle, long aMessage, long aIconType)

Unsafe version of: notifyPopup

ntinyfd_openFileDialogback to summary
public static native long ntinyfd_openFileDialog(long aTitle, long aDefaultPathAndFile, int aNumOfFilterPatterns, long aFilterPatterns, long aSingleFilterDescription, int aAllowMultipleSelects)

Unsafe version of: openFileDialog

Parameters
aNumOfFilterPatterns:int

the number of patterns in aFilterPatterns

ntinyfd_saveFileDialogback to summary
public static native long ntinyfd_saveFileDialog(long aTitle, long aDefaultPathAndFile, int aNumOfFilterPatterns, long aFilterPatterns, long aSingleFilterDescription)

Unsafe version of: saveFileDialog

Parameters
aNumOfFilterPatterns:int

the number of patterns in aFilterPatterns

ntinyfd_selectFolderDialogback to summary
public static native long ntinyfd_selectFolderDialog(long aTitle, long aDefaultPath)

Unsafe version of: selectFolderDialog

ntinyfd_setGlobalIntback to summary
public static native int ntinyfd_setGlobalInt(long aIntVariableName, int aValue)

Unsafe version of: setGlobalInt

tinyfd_beepback to summary
public static native void tinyfd_beep()
tinyfd_colorChooserback to summary
public static String tinyfd_colorChooser(ByteBuffer aTitle, ByteBuffer aDefaultHexRGB, ByteBuffer aDefaultRGB, ByteBuffer aoResultRGB)

Displays a color chooser dialog.

Parameters
aTitle:ByteBuffer

the dialog title or NULL

aDefaultHexRGB:ByteBuffer

NULL or "#FF0000"

aDefaultRGB:ByteBuffer

{ 0 , 255 , 255 }. Used only if aDefaultHexRGB is NULL.

aoResultRGB:ByteBuffer

returns the selected color. aDefaultRGB and aoResultRGB can be the same array.

Returns:String

the selected hexcolor as a string "#FF0000" or NULL on cancel

Annotations
@Nullable
@NativeType:char const *
tinyfd_colorChooserback to summary
public static String tinyfd_colorChooser(CharSequence aTitle, CharSequence aDefaultHexRGB, ByteBuffer aDefaultRGB, ByteBuffer aoResultRGB)

Displays a color chooser dialog.

Parameters
aTitle:CharSequence

the dialog title or NULL

aDefaultHexRGB:CharSequence

NULL or "#FF0000"

aDefaultRGB:ByteBuffer

{ 0 , 255 , 255 }. Used only if aDefaultHexRGB is NULL.

aoResultRGB:ByteBuffer

returns the selected color. aDefaultRGB and aoResultRGB can be the same array.

Returns:String

the selected hexcolor as a string "#FF0000" or NULL on cancel

Annotations
@Nullable
@NativeType:char const *
tinyfd_getGlobalCharback to summary
public static String tinyfd_getGlobalChar(ByteBuffer aCharVariableName)
Parameters
aCharVariableName:ByteBuffer

one of:

versionneedsresponse
Returns:String

NULL on error

Annotations
@Nullable
@NativeType:char const *
tinyfd_getGlobalCharback to summary
public static String tinyfd_getGlobalChar(CharSequence aCharVariableName)
Parameters
aCharVariableName:CharSequence

one of:

versionneedsresponse
Returns:String

NULL on error

Annotations
@Nullable
@NativeType:char const *
tinyfd_getGlobalIntback to summary
public static int tinyfd_getGlobalInt(ByteBuffer aIntVariableName)
Parameters
aIntVariableName:ByteBuffer

one of:

verbosesilentallowCursesDialogsforceConsoleassumeGraphicDisplaywinUtf8
Returns:int

-1 on error

tinyfd_getGlobalIntback to summary
public static int tinyfd_getGlobalInt(CharSequence aIntVariableName)
Parameters
aIntVariableName:CharSequence

one of:

verbosesilentallowCursesDialogsforceConsoleassumeGraphicDisplaywinUtf8
Returns:int

-1 on error

tinyfd_inputBoxback to summary
public static String tinyfd_inputBox(ByteBuffer aTitle, ByteBuffer aMessage, ByteBuffer aDefaultInput)

Displays an input dialog.

Parameters
aTitle:ByteBuffer

the dialog title or NULL

aMessage:ByteBuffer

the message or NULL. May NOT contain \n and \t characters on Windows.

aDefaultInput:ByteBuffer

if NULL it's a password box

Returns:String

the input value or NULL on cancel

Annotations
@Nullable
@NativeType:char const *
tinyfd_inputBoxback to summary
public static String tinyfd_inputBox(CharSequence aTitle, CharSequence aMessage, CharSequence aDefaultInput)

Displays an input dialog.

Parameters
aTitle:CharSequence

the dialog title or NULL

aMessage:CharSequence

the message or NULL. May NOT contain \n and \t characters on Windows.

aDefaultInput:CharSequence

if NULL it's a password box

Returns:String

the input value or NULL on cancel

Annotations
@Nullable
@NativeType:char const *
tinyfd_messageBoxback to summary
public static boolean tinyfd_messageBox(ByteBuffer aTitle, ByteBuffer aMessage, ByteBuffer aDialogType, ByteBuffer aIconType, boolean aDefaultButton)

Displays a message dialog.

Parameters
aTitle:ByteBuffer

the dialog title or NULL

aMessage:ByteBuffer

the message or NULL. It may contain \n and \t characters.

aDialogType:ByteBuffer

the dialog type. One of:

"ok""okcancel""yesno""yesnocancel"
aIconType:ByteBuffer

the icon type. One of:

"info""warning""error""question"
aDefaultButton:boolean

0 for cancel/no, 1 for ok/yes

Returns:boolean

0 for cancel/no, 1 for ok/yes, 2 for no in yesnocancel

Annotations
@NativeType:int
tinyfd_messageBoxback to summary
public static boolean tinyfd_messageBox(CharSequence aTitle, CharSequence aMessage, CharSequence aDialogType, CharSequence aIconType, boolean aDefaultButton)

Displays a message dialog.

Parameters
aTitle:CharSequence

the dialog title or NULL

aMessage:CharSequence

the message or NULL. It may contain \n and \t characters.

aDialogType:CharSequence

the dialog type. One of:

"ok""okcancel""yesno""yesnocancel"
aIconType:CharSequence

the icon type. One of:

"info""warning""error""question"
aDefaultButton:boolean

0 for cancel/no, 1 for ok/yes

Returns:boolean

0 for cancel/no, 1 for ok/yes, 2 for no in yesnocancel

Annotations
@NativeType:int
tinyfd_notifyPopupback to summary
public static int tinyfd_notifyPopup(ByteBuffer aTitle, ByteBuffer aMessage, ByteBuffer aIconType)

Displays a notification popup.

Parameters
aTitle:ByteBuffer

the dialog title or NULL

aMessage:ByteBuffer

the message or NULL. It may contain \n and \t characters.

aIconType:ByteBuffer

the icon type. One of:

"info""warning""error"
tinyfd_notifyPopupback to summary
public static int tinyfd_notifyPopup(CharSequence aTitle, CharSequence aMessage, CharSequence aIconType)

Displays a notification popup.

Parameters
aTitle:CharSequence

the dialog title or NULL

aMessage:CharSequence

the message or NULL. It may contain \n and \t characters.

aIconType:CharSequence

the icon type. One of:

"info""warning""error"
tinyfd_openFileDialogback to summary
public static String tinyfd_openFileDialog(ByteBuffer aTitle, ByteBuffer aDefaultPathAndFile, PointerBuffer aFilterPatterns, ByteBuffer aSingleFilterDescription, boolean aAllowMultipleSelects)

Displays a file open dialog.

Parameters
aTitle:ByteBuffer

the dialog title or NULL

aDefaultPathAndFile:ByteBuffer

the default path and/or file or NULL

aFilterPatterns:PointerBuffer

an array of file type patterns (NULL or {"*.jpg","*.png"}

aSingleFilterDescription:ByteBuffer

NULL or "image files"

aAllowMultipleSelects:boolean

if true, multiple selections are allowed

Returns:String

the file(s) selected or NULL on cancel. In case of multiple files, the separator is '|'.

Annotations
@Nullable
@NativeType:char const *
tinyfd_openFileDialogback to summary
public static String tinyfd_openFileDialog(CharSequence aTitle, CharSequence aDefaultPathAndFile, PointerBuffer aFilterPatterns, CharSequence aSingleFilterDescription, boolean aAllowMultipleSelects)

Displays a file open dialog.

Parameters
aTitle:CharSequence

the dialog title or NULL

aDefaultPathAndFile:CharSequence

the default path and/or file or NULL

aFilterPatterns:PointerBuffer

an array of file type patterns (NULL or {"*.jpg","*.png"}

aSingleFilterDescription:CharSequence

NULL or "image files"

aAllowMultipleSelects:boolean

if true, multiple selections are allowed

Returns:String

the file(s) selected or NULL on cancel. In case of multiple files, the separator is '|'.

Annotations
@Nullable
@NativeType:char const *
tinyfd_saveFileDialogback to summary
public static String tinyfd_saveFileDialog(ByteBuffer aTitle, ByteBuffer aDefaultPathAndFile, PointerBuffer aFilterPatterns, ByteBuffer aSingleFilterDescription)

Displays a file save dialog.

Parameters
aTitle:ByteBuffer

the dialog title or NULL

aDefaultPathAndFile:ByteBuffer

the default path and/or file or NULL

aFilterPatterns:PointerBuffer

an array of file type patterns (NULL or {"*.jpg","*.png"}

aSingleFilterDescription:ByteBuffer

NULL or "image files"

Returns:String

the selected file path or NULL on cancel

Annotations
@Nullable
@NativeType:char const *
tinyfd_saveFileDialogback to summary
public static String tinyfd_saveFileDialog(CharSequence aTitle, CharSequence aDefaultPathAndFile, PointerBuffer aFilterPatterns, CharSequence aSingleFilterDescription)

Displays a file save dialog.

Parameters
aTitle:CharSequence

the dialog title or NULL

aDefaultPathAndFile:CharSequence

the default path and/or file or NULL

aFilterPatterns:PointerBuffer

an array of file type patterns (NULL or {"*.jpg","*.png"}

aSingleFilterDescription:CharSequence

NULL or "image files"

Returns:String

the selected file path or NULL on cancel

Annotations
@Nullable
@NativeType:char const *
tinyfd_selectFolderDialogback to summary
public static String tinyfd_selectFolderDialog(ByteBuffer aTitle, ByteBuffer aDefaultPath)

Displays a folder selection dialog.

Parameters
aTitle:ByteBuffer

the dialog title or NULL

aDefaultPath:ByteBuffer

the default path or NULL

Annotations
@Nullable
@NativeType:char const *
tinyfd_selectFolderDialogback to summary
public static String tinyfd_selectFolderDialog(CharSequence aTitle, CharSequence aDefaultPath)

Displays a folder selection dialog.

Parameters
aTitle:CharSequence

the dialog title or NULL

aDefaultPath:CharSequence

the default path or NULL

Annotations
@Nullable
@NativeType:char const *
tinyfd_setGlobalIntback to summary
public static int tinyfd_setGlobalInt(ByteBuffer aIntVariableName, int aValue)
Parameters
aIntVariableName:ByteBuffer

one of:

verbosesilentallowCursesDialogsforceConsoleassumeGraphicDisplaywinUtf8
Returns:int

-1 on error

tinyfd_setGlobalIntback to summary
public static int tinyfd_setGlobalInt(CharSequence aIntVariableName, int aValue)
Parameters
aIntVariableName:CharSequence

one of:

verbosesilentallowCursesDialogsforceConsoleassumeGraphicDisplaywinUtf8
Returns:int

-1 on error