mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 23:07:15 -06:00
System File Chooser: Linux: show file dialog in dark if current FlatLaf theme is dark (PR #988)
This commit is contained in:
@@ -37,7 +37,7 @@ import com.formdev.flatlaf.util.SystemInfo;
|
||||
*/
|
||||
public class FlatNativeLinuxLibrary
|
||||
{
|
||||
private static int API_VERSION_LINUX = 3002;
|
||||
private static int API_VERSION_LINUX = 3003;
|
||||
|
||||
/**
|
||||
* Checks whether native library is loaded/available.
|
||||
@@ -178,6 +178,7 @@ public class FlatNativeLinuxLibrary
|
||||
* to avoid blocking the AWT event dispatching thread.
|
||||
*
|
||||
* @param owner the owner of the file dialog; or {@code null}
|
||||
* @param dark preferred appearance of the file dialog: {@code 1} = prefer dark, {@code 0} = prefer light, {@code -1} = default
|
||||
* @param open if {@code true}, shows the open dialog; if {@code false}, shows the save dialog
|
||||
* @param title text displayed in dialog title; or {@code null}
|
||||
* @param okButtonLabel text displayed in default button; or {@code null}.
|
||||
@@ -199,7 +200,7 @@ public class FlatNativeLinuxLibrary
|
||||
*
|
||||
* @since 3.7
|
||||
*/
|
||||
public native static String[] showFileChooser( Window owner, boolean open,
|
||||
public native static String[] showFileChooser( Window owner, int dark, boolean open,
|
||||
String title, String okButtonLabel, String currentName, String currentFolder,
|
||||
int optionsSet, int optionsClear, FileChooserCallback callback,
|
||||
int fileTypeIndex, String... fileTypes );
|
||||
|
||||
@@ -1085,6 +1085,7 @@ public class SystemFileChooser
|
||||
|
||||
@Override
|
||||
String[] showSystemDialog( Window owner, SystemFileChooser fc ) {
|
||||
int dark = FlatLaf.isLafDark() ? 1 : 0;
|
||||
boolean open = (fc.getDialogType() == OPEN_DIALOG);
|
||||
String approveButtonText = fc.getApproveButtonText();
|
||||
int approveButtonMnemonic = fc.getApproveButtonMnemonic();
|
||||
@@ -1162,7 +1163,7 @@ public class SystemFileChooser
|
||||
} : null;
|
||||
|
||||
// show system file dialog
|
||||
return FlatNativeLinuxLibrary.showFileChooser( owner, open,
|
||||
return FlatNativeLinuxLibrary.showFileChooser( owner, dark, open,
|
||||
fc.getDialogTitle(), approveButtonText, currentName, currentFolder,
|
||||
optionsSet, optionsClear, callback,
|
||||
fileTypeIndex, fileTypes.toArray( new String[fileTypes.size()] ) );
|
||||
|
||||
Reference in New Issue
Block a user