NumberFormatTextField agregado en el campo value de ingresos y formateado los campos integer en los tablemodels
This commit is contained in:
@@ -27,16 +27,21 @@ package danielcortes.xyz.views.components;
|
||||
import danielcortes.xyz.models.egreso.Egreso;
|
||||
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class EgresosTableModel extends AbstractTableModel {
|
||||
private String[] columns;
|
||||
private ArrayList<Egreso> rows;
|
||||
private NumberFormat nf;
|
||||
|
||||
|
||||
public EgresosTableModel(){
|
||||
super();
|
||||
this.columns = new String[]{"N°", "Descripcion", "Valor", "Tipo"};
|
||||
this.rows = new ArrayList<>();
|
||||
this.nf = NumberFormat.getIntegerInstance();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,7 +91,7 @@ public class EgresosTableModel extends AbstractTableModel {
|
||||
case 1:
|
||||
return rows.get(row).getDescripcion();
|
||||
case 2:
|
||||
return rows.get(row).getValor();
|
||||
return nf.format(rows.get(row).getValor());
|
||||
case 3:
|
||||
return rows.get(row).getTipoEgreso();
|
||||
}
|
||||
@@ -97,12 +102,4 @@ public class EgresosTableModel extends AbstractTableModel {
|
||||
return rows.get(row);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int columnIndex) {
|
||||
if (rows.isEmpty()) {
|
||||
return Object.class;
|
||||
}
|
||||
return getValueAt(0, columnIndex).getClass();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user