ImageIO.write no funciona?
Estoy escribiendo una pintura 3D y encontré un problema en Java. En una parte del código está funcionando:
try {
ImageIcon savePane=new ImageIcon("save.png");
String FilePath= (String)JOptionPane.showInputDialog(null,"Enter file path and name\n Warning: Instead of one '\\' 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();
}
Mientras que en otro no funciona:
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();
}
¿Puedes decirme cómo hacer que funcione? Gracias Antes de preguntar, sí, ejecuta esa parte del código, lo verifiqué.
Editar:
Ohhh trabajando bien ahora gracias