- display message when unable to open DDS image
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7962 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
67a8ed6fc7
commit
59d2c95991
@ -42,7 +42,7 @@
|
|||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
|
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<Component id="jScrollPane3" alignment="0" pref="477" max="32767" attributes="0"/>
|
<Component id="jScrollPane3" alignment="0" pref="485" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
@ -63,8 +63,8 @@
|
|||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="infoLabel" alignment="0" pref="488" max="32767" attributes="1"/>
|
<Component id="infoLabel" alignment="0" pref="553" max="32767" attributes="1"/>
|
||||||
<Component id="jScrollPane2" alignment="0" pref="488" max="32767" attributes="1"/>
|
<Component id="jScrollPane2" alignment="0" pref="553" max="32767" attributes="1"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
@ -132,7 +132,7 @@
|
|||||||
<Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="okButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="okButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace pref="11" max="32767" attributes="0"/>
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
|
@ -35,6 +35,8 @@ import Model.DDSImageFile;
|
|||||||
import com.jme3.gde.core.assets.ProjectAssetManager;
|
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||||
import com.jme3.gde.core.util.TreeUtil;
|
import com.jme3.gde.core.util.TreeUtil;
|
||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -74,7 +76,7 @@ public class TextureBrowser extends javax.swing.JDialog implements TreeSelection
|
|||||||
initComponents();
|
initComponents();
|
||||||
loadAvailableTextures();
|
loadAvailableTextures();
|
||||||
setSelectedTexture((Texture) editor.getValue());
|
setSelectedTexture((Texture) editor.getValue());
|
||||||
setLocationRelativeTo(null);
|
setLocationRelativeTo(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
@ -303,12 +305,17 @@ public class TextureBrowser extends javax.swing.JDialog implements TreeSelection
|
|||||||
newicon = new ImageIcon(bufferedImage);
|
newicon = new ImageIcon(bufferedImage);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
|
BufferedImage img = new BufferedImage(320, 240, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
Graphics2D g2d = (Graphics2D) img.getGraphics();
|
||||||
|
g2d.setColor(Color.white);
|
||||||
|
g2d.drawString("Cannot display image", 15, 15);
|
||||||
|
newicon = new ImageIcon(img);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
||||||
}
|
}
|
||||||
imagePreviewLabel.setIcon(newicon);
|
imagePreviewLabel.setIcon(newicon);
|
||||||
infoLabel.setText(" "+node.getUserObject() + " w : " + newicon.getIconWidth() + " h : " + newicon.getIconHeight());
|
infoLabel.setText(" " + node.getUserObject() + " w : " + newicon.getIconWidth() + " h : " + newicon.getIconHeight());
|
||||||
} else {
|
} else {
|
||||||
imagePreviewLabel.setIcon(null);
|
imagePreviewLabel.setIcon(null);
|
||||||
infoLabel.setText("");
|
infoLabel.setText("");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user