Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Witched Swing JTable!!

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi There:

I hope anyone can give me a hint on this WEIRD behavior (I am really scared!):

Say you have this code somewhere:


In TablaAmparos.java (Which encapsulates a JTable object to add some functionality):


Now in the same Class:


So when I call getListaAmparos() the console should tell me that every row has an "Amparo". Well, surprisingly, it happens exactly that way:


DATA: RESPONSABILIDAD CIVIL CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: PERDIDA TOTAL HURTO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: PERDIDA TOTAL DA#OS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: PERDIDA PARCIAL DA#OS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA JURIDICA PENAL CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA JURIDICA CIVIL CLASS: class co.com.liberty.generales.autos.domain.Amparo //Pay special attention on this one!
DATA: P�RDIDA PARCIAL HURTO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA PRELEGAL AUTOS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA ODONTOLOGICA AUTOS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: GASTOS TRANSPORTE POR HURTO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: TERREMOTO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: GASTOS TRANSPORTE DA#OS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: AMPARO PATRIMONIAL CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: NO APLICACION DEDUCIBLE CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: INDICE VARIABLE CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA EN VIAJE CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: RESTITUCION VR A NUEVO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ACCIDENTES PERSONALES CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: RESPONSABILIDAD CIVIL GRAL FLI CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: VEHICULO SUSTITUTO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: CASA CARCEL CLASS: class co.com.liberty.generales.autos.domain.Amparo


Every thing is fine until now, obviously the label appears after the toString overloading in Amparo, but...

Here comes the WEIRD thing...

This table has a TableCellEditor and Renderer that paints a checkbox in the last column and a JComboBox in the
third column of the first row (only the first), to select a value in that cell. Here is the code:

IN:


Where limite is the JComboBox...

Well, everything works fine, but, when I select something on the JComboBox or simply step to select any row in the table, the next call to
getListaAmparos() generates this output:


DATA: RESPONSABILIDAD CIVIL CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: PERDIDA TOTAL HURTO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: PERDIDA TOTAL DA#OS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: PERDIDA PARCIAL DA#OS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA JURIDICA PENAL CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA JURIDICA CIVIL CLASS: class java.lang.String //<------ CAN YOU BELIEVE THIS!!! It changes magically to String!!!
Pues este NO es un amparo: ASISTENCIA JURIDICA CIVIL - CLASS: class java.lang.String
java.lang.ClassCastException: java.lang.String
at co.com.liberty.generales.autos.webservice.client.gui.TablaAmparos.getListaAmparos(TablaAmparos.java:109)
at co.com.liberty.generales.autos.webservice.client.gui.VentanaPrincipalPE.getListaAmparos(VentanaPrincipalPE.java:243)
...



Remember how every row has an "Amparo" in the second column??? Well, here it comes Harry Potter and Stringo Patronum!!

I swear that no other code is filling the table and no body else touch the data... So...

What ITH can be happening??

I Hope somebody can do the Mith Busters job and solve this!...

Thanks in advance...

Happy Coding!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic