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


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

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

Newsgroups comp.lang.java.programmer
Date 2012-09-21 11:43 -0700
References <e4bc8305-301d-461e-a218-5c0529c1cc67@googlegroups.com> <0w17s.127$l36.73@newsfe20.iad>
Message-ID <9db3f5bc-d91a-4452-8bf6-8825d994038e@googlegroups.com> (permalink)
Subject Re: CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean
From clusardi2k@aol.com

Show all headers | View raw


On Friday, September 21, 2012 1:31:41 PM UTC-4, Daniel Pitts wrote:
> 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.

If I use the below code I don't get the error, but I get "false" strings in the column.
             public Class getColumnClass(int column) { 
               Class returnValue; 
               if (column == 1) returnValue = String.class;
               else if ((column >= 1) && (column < getColumnCount())) { 
                 returnValue = getValueAt(0, column).getClass(); 
               } else { 
                 returnValue = Object.class; 
               } 
               return returnValue; 
             } 

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