Skip to content

Commit

Permalink
stay in edit when date is unparsable
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Oct 18, 2014
1 parent 8866dcd commit c5868e8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/de/mpg/molgen/buczek/portifix/Gui.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,14 @@ private void stopEdit() {
updateForm();
}

private void saveThis() {
private void saveThis() throws ParseException {
int selected[] = jTable1.getSelectedRows();

try {
String s = textField_datum.getText();
Date d = MyDateFormat.parse(s);
for (int i = 0; i < selected.length; i++) {
tableModel.setNewDateThis(jTable1.convertRowIndexToModel(selected[i]), d);
}
} catch (ParseException exception) {
// invalid date string. keep old values
}
}

public Gui() {
Expand Down Expand Up @@ -248,7 +244,12 @@ public void actionPerformed(ActionEvent e) {
button_ok.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
saveThis();
try {
saveThis();
} catch (ParseException ex) {
textField_datum.requestFocus();
return;
}
stopEdit();
}
});
Expand Down

0 comments on commit c5868e8

Please sign in to comment.