Class FlatNativeLinuxLibrary
Note: This is private API. Do not use!
- Since:
- 2.5
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final inthttps://docs.gtk.org/gtk3/iface.FileChooser.html#propertiesstatic final inthttps://docs.gtk.org/gtk3/iface.FileChooser.html#propertiesstatic final inthttps://docs.gtk.org/gtk3/iface.FileChooser.html#propertiesstatic final inthttps://docs.gtk.org/gtk3/iface.FileChooser.html#propertiesstatic final inthttps://docs.gtk.org/gtk3/iface.FileChooser.html#propertiesstatic final inthttps://docs.gtk.org/gtk3/iface.FileChooser.html#properties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanChecks whether GTK 3 is available.static booleanisLoaded()Checks whether native library is loaded/available.static String[]showFileChooser(Window owner, int dark, boolean open, String title, String okButtonLabel, String currentName, String currentFolder, int optionsSet, int optionsClear, FlatNativeLinuxLibrary.FileChooserCallback callback, int fileTypeIndex, String[] fileTypes, int[] retFileTypeIndex) Shows the Linux/GTK system file dialog GtkFileChooserDialog.static intshowMessageDialog(long hwndParent, int messageType, String primaryText, String secondaryText, int defaultButton, String... buttons) Shows a GTK message box GtkMessageDialog.
-
Field Details
-
FC_select_folder
public static final int FC_select_folderhttps://docs.gtk.org/gtk3/iface.FileChooser.html#properties- Since:
- 3.7
- See Also:
-
FC_select_multiple
public static final int FC_select_multiplehttps://docs.gtk.org/gtk3/iface.FileChooser.html#properties- Since:
- 3.7
- See Also:
-
FC_local_only
public static final int FC_local_onlyhttps://docs.gtk.org/gtk3/iface.FileChooser.html#properties- Since:
- 3.7
- See Also:
-
FC_do_overwrite_confirmation
public static final int FC_do_overwrite_confirmationhttps://docs.gtk.org/gtk3/iface.FileChooser.html#properties- Since:
- 3.7
- See Also:
-
FC_create_folders
public static final int FC_create_foldershttps://docs.gtk.org/gtk3/iface.FileChooser.html#properties- Since:
- 3.7
- See Also:
-
-
Constructor Details
-
FlatNativeLinuxLibrary
public FlatNativeLinuxLibrary()
-
-
Method Details
-
isLoaded
public static boolean isLoaded()Checks whether native library is loaded/available.Note: It is required to invoke this method before invoking any other method of this class. Otherwise, the native library may not be loaded.
-
isGtk3Available
public static boolean isGtk3Available()Checks whether GTK 3 is available. Use this before invoking any native method that uses GTK. Otherwise the app may terminate immediately if GTK is not installed.This works because Java uses
dlopen(RTLD_LAZY)to load JNI libraries, which only resolves symbols as the code that references them is executed.- Since:
- 3.7
-
showFileChooser
public static String[] showFileChooser(Window owner, int dark, boolean open, String title, String okButtonLabel, String currentName, String currentFolder, int optionsSet, int optionsClear, FlatNativeLinuxLibrary.FileChooserCallback callback, int fileTypeIndex, String[] fileTypes, int[] retFileTypeIndex) Shows the Linux/GTK system file dialog GtkFileChooserDialog.Uses
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDERifFC_select_folderis set in parameteroptionsSet. Otherwise usesGTK_FILE_CHOOSER_ACTION_OPENif parameteropenistrue, orGTK_FILE_CHOOSER_ACTION_SAVEiffalse.Note: This method blocks the current thread until the user closes the file dialog. It is highly recommended to invoke it from a new thread to avoid blocking the AWT event dispatching thread.
- Parameters:
owner- the owner of the file dialog; ornulldark- preferred appearance of the file dialog:1= prefer dark,0= prefer light,-1= defaultopen- iftrue, shows the open dialog; iffalse, shows the save dialogtitle- text displayed in dialog title; ornullokButtonLabel- text displayed in default button; ornull. Use '_' for mnemonics (e.g. "_Choose") Use '__' for '_' character (e.g. "Choose__and__Quit").currentName- user-editable filename currently shown in the filename field in save dialog; ornullcurrentFolder- current directory shown in the dialog; ornulloptionsSet- options to set; seeFC_*constantsoptionsClear- options to clear; seeFC_*constantscallback- approve callback; ornullfileTypeIndex- the file type that appears as selected (zero-based)fileTypes- file types that the dialog can open or save. Two or more strings andnullare required for each filter. First string is the display name of the filter shown in the combobox (e.g. "Text Files"). Subsequent strings are the filter patterns (e.g. "*.txt" or "*").nullis required to mark end of filter.retFileTypeIndex- returns selected file type (zero-based); array must be have one element- Returns:
- file path(s) that the user selected; an empty array if canceled;
or
nullon failures (no dialog shown) - Since:
- 3.7.1
-
showMessageDialog
public static int showMessageDialog(long hwndParent, int messageType, String primaryText, String secondaryText, int defaultButton, String... buttons) Shows a GTK message box GtkMessageDialog.For use in
FlatNativeLinuxLibrary.FileChooserCallbackonly.- Parameters:
hwndParent- the parent of the message boxmessageType- type of message being displayed:JOptionPane.ERROR_MESSAGE,JOptionPane.INFORMATION_MESSAGE,JOptionPane.WARNING_MESSAGE,JOptionPane.QUESTION_MESSAGEorJOptionPane.PLAIN_MESSAGEprimaryText- primary text; if the dialog has a secondary text, this will appear as title in a larger bold fontsecondaryText- secondary text; shown below of primary text; ornulldefaultButton- index of the default button, which can be pressed using ENTER keybuttons- texts of the buttons; if no buttons given the a default "OK" button is shown. Use '_' for mnemonics (e.g. "_Choose") Use '__' for '_' character (e.g. "Choose__and__Quit").- Returns:
- index of pressed button; or -1 for ESC key
- Since:
- 3.7
-