Java files/mainFrame.java
private void saveItems() {
		Component[] list = itemsPanel.getComponents();
		ArrayList<Object> list2 = new ArrayList<Object>();
		PriceItemSerializable itemS = null;
		
		try {
			
			File f = new File("Items.Data");
			if (!f.exists()) {
				f.createNewFile();
			}
			
			FileOutputStream fOut = new FileOutputStream("Items.data");
			ObjectOutputStream oOut = new ObjectOutputStream(fOut);
			
			for (int i = 0; i < itemsPanel.getComponentCount(); i++) {
				if ((list[i].getClass().getName().toString().equals("PriceItem"))){
					//converts PriceItems to serializable items
					itemS = new PriceItemSerializable((PriceItem)list[i]);
					list2.add(itemS);
				}
			}
			
			oOut.writeObject((Object) list2);
			
			oOut.close();
			fOut.close();
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
//save items to a saved file - persistent items
save items to a saved file - persistent items
save items to a saved file - persistent items
private void saveItems() {
		Component[] list = itemsPanel.getComponents();
		ArrayList<Object> list2 = new ArrayList<Object>();
		PriceItemSerializable itemS = null;
		try {
			File f = new File("Items.Data");
			if (!f.exists()) {
				f.createNewFile();
			}
			FileOutputStream fOut = new FileOutputStream("Items.data");
			ObjectOutputStream oOut = new ObjectOutputStream(fOut);
			for (int i = 0; i < itemsPanel.getComponentCount(); i++) {
				if ((list[i].getClass().getName().toString().equals("PriceItem"))){
					itemS = new PriceItemSerializable((PriceItem)list[i]);
					list2.add(itemS);
				}
			}
			oOut.writeObject((Object) list2);
			oOut.close();
			fOut.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
private void saveItems ( ) { Component [ ] list = itemsPanel . getComponents ( ) ; ArrayList < Object > list2 = new ArrayList < Object > ( ) ; PriceItemSerializable itemS = null ; try { File f = new File ( "Items.Data" ) ; if ( ! f . exists ( ) ) { f . createNewFile ( ) ; } FileOutputStream fOut = new FileOutputStream ( "Items.data" ) ; ObjectOutputStream oOut = new ObjectOutputStream ( fOut ) ; for ( int i = 0 ; i < itemsPanel . getComponentCount ( ) ; i ++ ) { if ( ( list [ i ] . getClass ( ) . getName ( ) . toString ( ) . equals ( "PriceItem" ) ) ) { itemS = new PriceItemSerializable ( ( PriceItem ) list [ i ] ) ; list2 . add ( itemS ) ; } } oOut . writeObject ( ( Object ) list2 ) ; oOut . close ( ) ; fOut . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } }
save items to a saved file - persistent items
save items to a saved file - persistent items
//converts PriceItems to serializable items