Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/08/2014, 00:47
Avatar de rgf1987
rgf1987
 
Fecha de Ingreso: diciembre-2012
Ubicación: Asturias
Mensajes: 269
Antigüedad: 12 años, 1 mes
Puntos: 22
Respuesta: Como mostrar datos de mysql en un jTable con Decimal Format

Puedes probar así:

Código Java:
Ver original
  1. DecimalFormat formato = new DecimalFormat("#####.00");
  2. System.out.println(formato.format(25));

Las # representan caracteres que solo aparecerán si existen en el argumento del formato, es decir, si tienes lo siguiente:

Código Java:
Ver original
  1. DecimalFormat formato = new DecimalFormat("#####.##");
  2. System.out.println(formato.format(25.0));

Imprimirá 25.0

Si tienes:

Código Java:
Ver original
  1. DecimalFormat formato = new DecimalFormat("#####.00");
  2. System.out.println(formato.format(25.1));

Imprimirá 25.10

Un saludo.