mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-12-03 17:28:00 +01:00
Remember the last opened location between picking files
This commit is contained in:
parent
6cc8e95991
commit
ec8efcaa76
1 changed files with 10 additions and 0 deletions
|
@ -2,6 +2,8 @@ package com.voxelmodpack.hdskins.upload.awt;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
@ -24,6 +26,8 @@ public abstract class ThreadOpenFile extends Thread {
|
|||
|
||||
private JFrame parent = null;
|
||||
|
||||
private static String lastChosenFile = null;
|
||||
|
||||
protected ThreadOpenFile(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback)
|
||||
throws IllegalStateException {
|
||||
if (minecraft.isFullScreen()) {
|
||||
|
@ -43,10 +47,16 @@ public abstract class ThreadOpenFile extends Thread {
|
|||
public void run() {
|
||||
fileDialog = new JFileChooser();
|
||||
fileDialog.setDialogTitle(this.dialogTitle);
|
||||
|
||||
if (lastChosenFile != null) {
|
||||
fileDialog.setSelectedFile(new File(lastChosenFile));
|
||||
}
|
||||
fileDialog.setFileFilter(this.getFileFilter());
|
||||
|
||||
int dialogResult = fileDialog.showOpenDialog(parent);
|
||||
|
||||
lastChosenFile = fileDialog.getSelectedFile().getAbsolutePath();
|
||||
|
||||
this.parentScreen.onFileOpenDialogClosed(fileDialog, dialogResult);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue