Fix java 6.

This commit is contained in:
Matthew Messinger 2015-08-12 17:40:52 -04:00
parent 963a5e5a73
commit 07246e2d16

View file

@ -24,6 +24,8 @@ import javax.swing.UIManager;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.JavaVersion;
import org.apache.commons.lang3.SystemUtils;
import org.lwjgl.BufferUtils; import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU; import org.lwjgl.util.glu.GLU;
@ -212,7 +214,10 @@ public class GuiSkinsMineLP extends GuiScreen implements IUploadCompleteCallback
* @wbp.parser.entryPoint * @wbp.parser.entryPoint
*/ */
private void enableDnd() { private void enableDnd() {
if (fileDrop != null && fileDrop.isVisible()) { if (!SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_7))
return;
if (fileDrop != null) {
fileDrop.setVisible(true);
return; return;
} }
fileDrop = new JFrame("Skin Drop"); fileDrop = new JFrame("Skin Drop");
@ -231,7 +236,7 @@ public class GuiSkinsMineLP extends GuiScreen implements IUploadCompleteCallback
txtInst.setHorizontalAlignment(SwingConstants.CENTER); txtInst.setHorizontalAlignment(SwingConstants.CENTER);
txtInst.setVerticalAlignment(SwingConstants.CENTER); txtInst.setVerticalAlignment(SwingConstants.CENTER);
panel.add(txtInst); panel.add(txtInst);
// Display.setParent(canvas);
DropTarget dt = new DropTarget(); DropTarget dt = new DropTarget();
fileDrop.setDropTarget(dt); fileDrop.setDropTarget(dt);
try { try {
@ -259,7 +264,8 @@ public class GuiSkinsMineLP extends GuiScreen implements IUploadCompleteCallback
@Override @Override
public void onGuiClosed() { public void onGuiClosed() {
super.onGuiClosed(); super.onGuiClosed();
this.fileDrop.dispose(); if (this.fileDrop != null)
this.fileDrop.dispose();
this.localPlayer.releaseTextures(); this.localPlayer.releaseTextures();
this.remotePlayer.releaseTextures(); this.remotePlayer.releaseTextures();
PonyManager.getInstance().getPonyFromResourceRegistry(this.localPlayer.getSkinTexture()).invalidateSkinCheck(); PonyManager.getInstance().getPonyFromResourceRegistry(this.localPlayer.getSkinTexture()).invalidateSkinCheck();
@ -273,7 +279,6 @@ public class GuiSkinsMineLP extends GuiScreen implements IUploadCompleteCallback
if (dialogResult == 0) { if (dialogResult == 0) {
this.loadLocalFile(fileDialog.getSelectedFile()); this.loadLocalFile(fileDialog.getSelectedFile());
} }
} }
private void loadLocalFile(File skinFile) { private void loadLocalFile(File skinFile) {