...
public class Haupt extends JFrame {
...
public Haupt() {
...
sorstor.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Vector v = model.getDataVector();
try {
int z = 1;
p1 = new Properties(System.getProperties());
for (int k = 0; k < model.getRowCount(); k++) {
for (int i = 0; i <= 8; i++) {
if(i==2 || i==5){
Date date = (Date) model.getValueAt(k, i);
SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy");
p1.setProperty(Integer.toString(z), f.format(date));
}else{
p1.setProperty(Integer.toString(z), model.getValueAt(k, i).toString());
}
z++;
}
}
Writer propOut = new FileWriter(Speicher);
p1.store(propOut, "Sicherung");
} catch (IOException t) {
System.out.print("Failed");
}
}
});
try {
p2 = new Properties();
Reader Propin = new FileReader(Speicher);
p2.load(Propin);
for (int i = 1; i <= p2.size();) {
SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy");
Date date1 = null;
String datum1 = p2.getProperty(Integer.toString(i + 2)).toString();
try {date1 = f.parse(datum1);
} catch (ParseException ex) {date1 = new Date();}
Date date2 = null;
String datum2 = p2.getProperty(Integer.toString(i + 5)).toString();
try {date2 = f.parse(datum2);
} catch (ParseException ex) {date2 = new Date();}
model.addRow(new Object[]{p2.getProperty(Integer.toString(i)).toString(), //0
p2.getProperty(Integer.toString(i + 1)).toString(), //1
date1, //2 Date
p2.getProperty(Integer.toString(i + 3)).toString(), //3
p2.getProperty(Integer.toString(i + 4)).toString(), //4
date2, //5 Date
p2.getProperty(Integer.toString(i + 6)).toString(), //6
p2.getProperty(Integer.toString(i + 7)).toString(), //7
p2.getProperty(Integer.toString(i + 8)).toString()});//8
i = i + 9;
}
} catch (IOException e) {}
}
}