Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/03/2011, 23:03
Avatar de HackmanC
HackmanC
 
Fecha de Ingreso: enero-2008
Ubicación: Guatemala
Mensajes: 1.817
Antigüedad: 16 años, 3 meses
Puntos: 260
Sonrisa Respuesta: Problema con TableCellRenderer

Hola,

Posiblemente,

Código Java:
Ver original
  1. @Override
  2.         public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
  3.             setBorder(hasFocus ? UIManager.getBorder("Table.focusCellHighlightBorder") : null);
  4.             setBackground(isSelected ? UIManager.getColor("Table.selectionBackground") : UIManager.getColor("Table.background"));
  5.             setFormatterFactory(new DefaultFormatterFactory(new NumberFormatter(new DecimalFormat("##,##0.00"))));
  6.             setHorizontalAlignment(SwingConstants.RIGHT);
  7.             Double valor = null;
  8.             if (value instanceof Double) valor = (Double)value;
  9.             setValue(valor);
  10.             return this;
  11.         }
Si el valor no es doble debe de ponerlo como null, sino te muestra el último valor que fue doble, al pintar solamente se crea una instancia.

Saludos,