java - ImageIO.write not working? -


i'm writing 3d paint , found problem in java. in 1 part of code it's working:

try {     imageicon savepane=new imageicon("save.png");     string filepath= (string)joptionpane.showinputdialog(null,"enter file path , name\n warning: instead of 1 '\\' write '\\\\'", "save",joptionpane.plain_message,savepane,null,"c:\\\\example.png");     bufferedimage image = new robot().createscreencapture(new rectangle(110,130,put.getwidth()-3,put.getheight()));     imageio.write(image, "png", new file(filepath));         system.out.println(filepath); } catch (ioexception e) {      e.printstacktrace(); } catch (headlessexception e) {     e.printstacktrace(); } catch (awtexception e) {     e.printstacktrace(); }  

while in 1 isn't working:

try {     string undofolder= "was.png";     bufferedimage image = new robot().createscreencapture(new rectangle(110,130,put.getwidth()-3,put.getheight()));     imageio.write(image, ".png",new file(undofolder));           } catch (ioexception e1) {     e1.printstacktrace(); } catch (awtexception e1) {     e1.printstacktrace(); } catch (headlessexception e3) {     e3.printstacktrace(); } 

can tell me how make work? before ask, yes execute part of code, checked.

edit:

ohhh working fine thanks

imageio.write(image, "png",new file(undofolder)); 

instead of:

imageio.write(image, ".png",new file(undofolder)); 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -