PINOYDEN.PH
PC Zone > Programming
[HELP] How to save drawing from jpanel
Reply
(1/1)
mr_zero: 2 years ago
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
mr_zero: 2 years ago
from java
mr_zero: 2 years ago
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]
Pages: 1
Home | Search | Login
Page created in 0.048