The table displays as expected, and renders the first columns
as checkboxes. But as soon as I click on the first checkbox, the following
exception occurs:
java.lang.ClassCastException
at
javax.swing.JTable$BooleanRenderer.getTableCellRendererComponent(JTable.java
:3401)
at javax.swing.JTable.prepareRenderer(JTable.java:3693)
at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:1149)
at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1051)
at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:974)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
at javax.swing.JComponent.paintComponent(JComponent.java:541)
at javax.swing.JComponent.paint(JComponent.java:808)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4771)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4724)
at javax.swing.JComponent._paintImmediately(JComponent.java:4668)
at javax.swing.JComponent.paintImmediately(JComponent.java:4477)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)
at
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQu
eueUtilities.java:117)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:448)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:197)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
After I have clicked on a checkbox once, this exception is thrown whatever i
do
in the table...
Any hints or obvious pitfalls I should be aware of?
I have tried to explicitly set the colums editor & renderer to JCheckbox,
too...
--
Dag
58°26'15.9" N 008°46'45.5" E
> I have a JTable with the following model:
/ ...
> Any hints or obvious pitfalls I should be aware of?
Just one. Avoid asking questions that include error stack dumps but that
don't include the relevant code.
> I have tried to explicitly set the colums editor & renderer to JCheckbox,
> too...
I'll bet if you submit your post to your Java compiler, it just won't know
what to do. Same here.
--
Paul Lutus
http://www.arachnoid.com
Usually I do agree with you, and I try to introduce my friends over
at c.l.b.v.m to Andrew Thompson's principle about "SSCCE":
(http://www.physci.org/codes/sscce.jsp#eg)
But sometimes it must be allowed to throw out a question about
a specific error without a compileable sample that reproduces
the error, in case somebody can make an educated guess based
on experience.
I know the chances of getting help is drastically reduced, but
that is a factor I'm willing to live with.
(Especially when the error suddenly appears in 6 months old code,
and its 4 hour to the next deadline) ...
:-)
We promise to equal your diligence and attention to detail.
> Any hints or obvious pitfalls I should be aware of?
> I have tried to explicitly set the colums editor & renderer to JCheckbox,
> too...
What does getColumnClass() return? Do you have a custom setValueAt()?
Or getValueAt()? There is so much that could affect this IN THE CODE
YOU DID NOT POST so it's hard to answer.
Yes I have an custom setValueAt(), and the error was buried there.
It was a
rows[r][c] = value.toString();
on a column that should have been:
rows[r][c] = value;
Thanks!