Author: mallon Date: 2012-08-13 14:31:11 +0200 (Mon, 13 Aug 2012) New Revision: 3600 Url: http://chorem.org/repositories/revision/lima/3600 Log: refs #705 Correction sur l editeur des cellules debit / credit. Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2012-08-10 16:53:07 UTC (rev 3599) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2012-08-13 12:31:11 UTC (rev 3600) @@ -157,9 +157,15 @@ * @param e keyEvent starting control of decimalSeparator * */ protected void limitComma(KeyEvent e) { - if ( (String.valueOf(e.getKeyChar()).matches("[^0-9]") - && getComponent().getText().length() > 2) ) { + if ( (String.valueOf(e.getKeyChar()).matches(",") || String.valueOf(e.getKeyChar()).matches("\\.")) + && comma.equals(",")) { getComponent().setText(getComponent().getText().substring(0, getComponent().getText().length()-1)); + } else if( (String.valueOf(e.getKeyChar()).matches(",") || String.valueOf(e.getKeyChar()).matches("\\.")) + && comma.equals("")) { + comma = ","; + } else if(!getComponent().getText().matches(",") || !getComponent().getText().matches(".") && + (!String.valueOf(e.getKeyChar()).matches(",") || !String.valueOf(e.getKeyChar()).matches("\\."))) { + comma = ""; } }