I would like to convert my desktop app to web app using Ajaxswing and as instructions say, I did all the same: http://ift.tt/2jCKj0a
The thing is that web app starts, but it doesn't load images. I put images to ajax images folder, but server still shows exception:
javax.imageio.IIOException: Can't read input file! at javax.imageio.ImageIO.read(ImageIO.java:1301)
Here is my code:
try {
img = ImageIO.read(new File("resources/images/blackStone.png"));
img = img.getScaledInstance(this.pixelSize, this.pixelSize, Image.SCALE_DEFAULT);
icon = new ImageIcon(img);
this.setOpaque(true);
this.setContentAreaFilled(true);
this.setIcon(icon);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Where img is Image
,icon is ImageIcon
and this is JButton
. What should be path to blackStone.png
. Any help would be appreciated :)
Aucun commentaire:
Enregistrer un commentaire