mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-23 12:58:01 +01:00
Removed the "InternalDialog"
This commit is contained in:
parent
f520998365
commit
9096a015c5
3 changed files with 5 additions and 24 deletions
|
@ -83,6 +83,10 @@ public class GLWindow extends DropTarget {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JFrame getFrame() {
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
private void open() throws LWJGLException {
|
private void open() throws LWJGLException {
|
||||||
// Dimensions from LWJGL may have a non 1:1 scale on high DPI monitors.
|
// Dimensions from LWJGL may have a non 1:1 scale on high DPI monitors.
|
||||||
int x = getScaledPixelUnit(Display.getX());
|
int x = getScaledPixelUnit(Display.getX());
|
||||||
|
|
|
@ -260,7 +260,7 @@ public class GuiSkins extends GuiScreen implements FutureCallback<SkinUploadResp
|
||||||
this.selectedSkin = null;
|
this.selectedSkin = null;
|
||||||
this.localPlayer.releaseTextures();
|
this.localPlayer.releaseTextures();
|
||||||
this.openFileThread = new ThreadOpenFilePNG(this.mc, I18n.format("hdskins.open.title"), this::onFileOpenDialogClosed);
|
this.openFileThread = new ThreadOpenFilePNG(this.mc, I18n.format("hdskins.open.title"), this::onFileOpenDialogClosed);
|
||||||
this.openFileThread.start();
|
this.openFileThread.setParent(GLWindow.current().getFrame()).start();
|
||||||
guiButton.enabled = false;
|
guiButton.enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,17 +2,10 @@ package com.voxelmodpack.hdskins.upload.awt;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
import java.awt.AWTEvent;
|
|
||||||
import java.awt.event.MouseEvent;
|
|
||||||
|
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
|
|
||||||
import org.lwjgl.opengl.Display;
|
|
||||||
|
|
||||||
import com.voxelmodpack.hdskins.Later;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for "open file" dialog threads
|
* Base class for "open file" dialog threads
|
||||||
*
|
*
|
||||||
|
@ -41,35 +34,19 @@ public abstract class ThreadOpenFile extends Thread {
|
||||||
this.dialogTitle = dialogTitle;
|
this.dialogTitle = dialogTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start() {
|
|
||||||
Later.performLater(0, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ThreadOpenFile setParent(JFrame parent) {
|
public ThreadOpenFile setParent(JFrame parent) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.parent.setAlwaysOnTop(true);
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (parent == null) {
|
|
||||||
parent = new JFrame("InternalDialog");
|
|
||||||
parent.setAlwaysOnTop(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
parent.requestFocusInWindow();
|
|
||||||
parent.setVisible(false);
|
|
||||||
|
|
||||||
fileDialog = new JFileChooser();
|
fileDialog = new JFileChooser();
|
||||||
fileDialog.setDialogTitle(this.dialogTitle);
|
fileDialog.setDialogTitle(this.dialogTitle);
|
||||||
fileDialog.setFileFilter(this.getFileFilter());
|
fileDialog.setFileFilter(this.getFileFilter());
|
||||||
|
|
||||||
int dialogResult = fileDialog.showOpenDialog(parent);
|
int dialogResult = fileDialog.showOpenDialog(parent);
|
||||||
|
|
||||||
parent.setVisible(true);
|
|
||||||
this.parentScreen.onFileOpenDialogClosed(fileDialog, dialogResult);
|
this.parentScreen.onFileOpenDialogClosed(fileDialog, dialogResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue