Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #18885

Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean

From Daniel Pitts <newsgroup.nospam@virtualinfinity.net>
Newsgroups comp.lang.java.programmer
Subject Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean
References <e4bc8305-301d-461e-a218-5c0529c1cc67@googlegroups.com>
Message-ID <0w17s.127$l36.73@newsfe20.iad> (permalink)
Date 2012-09-21 10:31 -0700

Show all headers | View raw


On 9/21/12 7:57 AM, clusardi2k@aol.com wrote:
> Hello, I have discovered a hidden error. My project was working for awhile, but then I started to get the below error.
>
> My error comes from the fact that I'm using a checkbox in a jtable, and I'm using the below "getColumnClass".
>
> Thank you,
>
> compile:
> run:
> Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
You are returning "Boolean.class" somewhere, but the actual content of 
the cell is a String.  That is *exactly* what the exception says. Your 
other program isn't updating the column with anything but a Boolean.

Make sure nothing in your code puts a String where it doesn't belong. 
Unit tests can be a helpful tool in that regard.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean clusardi2k@aol.com - 2012-09-21 07:57 -0700
  Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean clusardi2k@aol.com - 2012-09-21 08:01 -0700
    Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean clusardi2k@aol.com - 2012-09-21 08:32 -0700
  Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-09-21 11:57 -0400
  Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-09-21 10:31 -0700
    Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean clusardi2k@aol.com - 2012-09-21 11:43 -0700
      Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean Lew <lewbloch@gmail.com> - 2012-09-21 12:21 -0700
        Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean clusardi2k@aol.com - 2012-09-21 21:16 -0700
        Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean clusardi2k@aol.com - 2012-09-21 21:23 -0700
          Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean clusardi2k@aol.com - 2012-09-22 08:22 -0700
            Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean Stuart <DerTopper@web.de> - 2012-09-23 16:44 +0200
  Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean Lew <lewbloch@gmail.com> - 2012-09-21 10:32 -0700
    Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean Roedy Green <see_website@mindprod.com.invalid> - 2012-09-22 15:37 -0700
  Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean Roedy Green <see_website@mindprod.com.invalid> - 2012-09-22 15:30 -0700

csiph-web