Topic: [HELP] How to save drawing from jpanel (Read 211 times)

01-19-19 10:37 AM
mr_zero
Semi-Newbie
  • Posts: 13
  • Thanked: 0
  • Reputation: 0
Mga boss pa help naman .. paano ma save ang ginawa kong drawing sa jpanel para maging Image at ma save ko kahit saang file at .. ma bigyan ng pangalan ang ginawa kung drawing sa jpanel... Salamat. project kasi po ..hehe

01-19-19 08:16 PM
mr_zero
Semi-Newbie
  • Posts: 13
  • Thanked: 0
  • Reputation: 0

01-20-19 10:07 AM
mr_zero
Semi-Newbie
  • Posts: 13
  • Thanked: 0
  • Reputation: 0
ito ung code na naeh search ko ayaw go mana .. pa.tulong naman mga bossing ..

BufferedImage image2 = new BufferedImage(panel.WIDTH, panel.HEIGHT, BufferedImage.TYPE_INT_RGB); JFileChooser jFile = new JFileChooser(); jFile.showSaveDialog(null); Path pth = jFile.getSelectedFile().toPath(); JOptionPane.showMessageDialog(null, pth.toString()); Graphics2D graphics2D = image2.createGraphics(); try { ImageIO.write(image2, "", new File(pth.toString())); } catch (IOException ox) { // TODO: handle exception ox.printStackTrace(); }

[mod]Dont's #6 PD rules Paki basa. [You are not allowed to view links. Register or Login][/mod]
« Last Edit: 01-20-19 12:50 PM by menshop »