Results 1 to 4 of 4
  1. #1
    girigl is offline Member
    Join Date
    Dec 2008
    Posts
    4
    Rep Power
    0

    Thumbs up Getting objects from JTable Cells.

    I have designed a Jtable with some number of rows and columns. Now when i choose some cell in particular row and column, I want it to return a object(of some class), But i don't want that object string to be displayed in those blocks. I want some string in those cells. I used addrow(Object,Vector). This method doesn't display object name in cells but this method creates a single object for whole row, which i don't want. I also tried with addrow(Vector) in which i get object for each cell but the object name is displayed in the cells.
    Can anyone please help me on this matter? :(
    Thanks in advance.

  2. #2
    Join Date
    Aug 2008
    Location
    kolkata
    Posts
    21
    Rep Power
    0

    Default

    I think that you can share the program (in short) & that will help me to think abt the program.....It's hard to think the solve......
    some senior member can help you out....thanx
    ..::SC::..

  3. #3
    girigl is offline Member
    Join Date
    Dec 2008
    Posts
    4
    Rep Power
    0

    Default

    tableobject.addRow(vRow); // tableobject is object of Jtable
    when we do this it adds row with no object within it. If we do this when we access some block(Single cell) in that table then that table return null as returning object for that cell.

    when i use
    tableobject.addRow(obj, vRow); // tableobject is object of Jtable, //obj is object of some class.
    It assigns a object for whole row i.e. single row. If i select any block (Single cell) in that row it will return obj, which i dont want. I want different objects of same class for all different blocks in table. for example (0,0) obj1 (0,1) obj2 (0,2) obj3 (0,3) obj4 ..
    (1,0) obj11 (1,1) obj12 (1,2) obj13 (1,3) obj14 ..
    (2,0) obj11 (2,1) obj22 (2,2) obj23 (2,3) obj24 ..
    .....
    ....
    hope u got the question.

  4. #4
    girigl is offline Member
    Join Date
    Dec 2008
    Posts
    4
    Rep Power
    0

    Thumbs up Got it.

    I got it. I just override toString() in that class. Before calling addRow() i just call Objectname.toString() of that object which i want when i click on table.
    toString() will return string which i want to display on table.
    Thnx

Similar Threads

  1. Color cells and rows in SWT table
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-11-2008, 04:31 PM
  2. Replies: 0
    Last Post: 07-11-2008, 03:07 PM
  3. merging selected table cells using javascript
    By Renjini in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 06-17-2008, 01:04 AM
  4. Replies: 2
    Last Post: 05-15-2008, 10:15 AM
  5. Replies: 0
    Last Post: 11-06-2007, 06:58 AM

Posting Permissions

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