我正在写3D画,在Java上发现了问题。
部分代码工作正常:
try {
imageiconsavepane=new image icon (save.png );
stringfilepath=(string ) JoptionPane.showinputdialog ) null,' Enter file path and name
warning : instead of one '' write '''、' Save '、JOptionPane.PLAIN_MESSAGE、savePane、null、' c3360
bufferedimageimage=new robot (.create screen capture ) new rectangle (110,130,put.getWidth )-3,put.getHeight
imageio.write(image,' png ',newfile ) (文件路径);
system.out.println(filepath );
}catch(ioexceptione ) {
e .打印任务跟踪(;
}catch(Headlessexceptione )
e .打印任务跟踪(;
}catch(awtexceptione ) {
e .打印任务跟踪(;
}
在另一种情况下,它不起作用:
try {
String UndoFolder='was.png ';
bufferedimageimage=new robot (.create screen capture ) new rectangle (110,130,put.getWidth )-3,put.getHeight
imageio.write(image,'.png ',newfile ) ) undofolder );
}catch(ioexceptionE1) {
E1 .打印堆栈跟踪(;
}catch(awtexceptionE1) {
E1 .打印堆栈跟踪(;
}catch(HeadlessexceptionE3) )
E3 .打印堆栈跟踪(;
}
能告诉我怎么让它发挥作用吗? 谢谢
在提问之前,是的,我执行了其中的一部分代码。 我检查过了。
编辑:
啊,我现在工作正常。 谢谢你