Results 1 to 3 of 3

Thread: JTable Row Rendering

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2001
    Location
    UK
    Posts
    222

    JTable Row Rendering

    Hello

    I am using a JTable, and would like to render rows instead of columns, I have implemented TableMode and obvioulsy there is a getColumnClass, which can be used to create default rendering with types such as Boolean etc..

    But this only applied to Columns, is there anyway of getting the same kind of functionality with Rows?! i.e. getRowClass


    Cheers

    Andy

  2. #2
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    What does Class getColumnClass(int column) return if a column has multiple rows? I would use Object getValueAt(int row, int col).

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2001
    Location
    UK
    Posts
    222

    getClass

    Well the GetClass(columnindex) returns the class of the column, so the tablecan prepare a renderer for it, there for if you return Boolean it will expect an Object of type Boolean when it calls getValueAt(column, Row), so if you don't return an Boolean it will throw a class cast exception.

    How ever, if you simpley return Object.class from the get class then it will expect an Object from get ValueAt which is fine, but then it simply calls toString() on the object and therefore does not have the desired effect!

    Hope that makes sense?!

    Andy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width