Posts

Showing posts from December 29, 2018

Serializing objetcs prints only last one

Image
0 currently I am facing this problem: I have an arraylist of objects (Shapes) and when I try to serialize it, it returns me only the last one. Here is the button that saves the whole project with the arraylist of shapes. //Setting action listener from the "save" button save.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ FileOutputStream out = null; PrintWriter print = null; String fName; JFileChooser jfc1 = new JFileChooser(); jfc1.setAcceptAllFileFilterUsed(false); jfc1.setFileFilter(xmlfilter); jfc1.setDialogTitle("Enter the file's name to save"); int value = jfc1.showSaveDialog((JMenuItem)e.getSource(