Renderer in TableModel

Discussion in 'Java' started by Ike, Oct 25, 2003.

  1. Ike

    Ike Guest

    I have a TableModel which extends AbstractTableModel. One of the columns I
    have is of possible Booleans.

    However, not ever row has a value - the Booleans occur sparsely as you
    travers down the rows.

    I'm trying to figure out how I can have a checkbox in only those cells in
    this column which actually HAVE a boolean value, and no check box in the
    cell if the value is null. Unfortunately, it seems, AbstractTableModel
    interface implementation puts the editor in ever cell of a given column.

    Anyone know any way around this? Thanks, Ike
     
    Ike, Oct 25, 2003
    #1
    1. Advertising

  2. Ike

    ak Guest

    May be it is easier to make it invisible?

    "Ike" <> schrieb im Newsbeitrag
    news:yZumb.2013$...
    > I have a TableModel which extends AbstractTableModel. One of the columns I
    > have is of possible Booleans.
    >
    > However, not ever row has a value - the Booleans occur sparsely as you
    > travers down the rows.
    >
    > I'm trying to figure out how I can have a checkbox in only those cells in
    > this column which actually HAVE a boolean value, and no check box in the
    > cell if the value is null. Unfortunately, it seems, AbstractTableModel
    > interface implementation puts the editor in ever cell of a given column.
    >
    > Anyone know any way around this? Thanks, Ike
    >
    >
     
    ak, Oct 25, 2003
    #2
    1. Advertising

  3. Ike

    Ike Guest

    But how do you mae individual cells be invisible in a derivation of
    AbstractTableModel? -Ike

    "ak" <> wrote in message news:bne93l$9ka$...
    > May be it is easier to make it invisible?
    >
     
    Ike, Oct 25, 2003
    #3
  4. Ike

    ak Guest

    Hmm, write your own TableCellEditor.

    you need to implement only one method:

    public Component getTableCellEditorComponent(JTable table,
    Object value,
    boolean isSelected,
    int row,
    int column)

    row and column are known, try to return null if cell is empty.


    "Ike" <> schrieb im Newsbeitrag
    news:enAmb.2360$...
    > But how do you mae individual cells be invisible in a derivation of
    > AbstractTableModel? -Ike
    >
    > "ak" <> wrote in message

    news:bne93l$9ka$...
    > > May be it is easier to make it invisible?
    > >

    >
    >
     
    ak, Oct 25, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian J. Sayatovic

    Sorting a JTable with a delegating TableModel

    Brian J. Sayatovic, Jul 10, 2003, in forum: Java
    Replies:
    2
    Views:
    1,546
    Kleopatra
    Jul 15, 2003
  2. Peter Grison
    Replies:
    1
    Views:
    5,584
  3. FET
    Replies:
    2
    Views:
    2,647
    Filip Larsen
    Jan 8, 2005
  4. farseer

    TableModel

    farseer, May 22, 2005, in forum: Java
    Replies:
    1
    Views:
    2,918
    Roland
    May 22, 2005
  5. farseer
    Replies:
    7
    Views:
    680
    farseer
    Jun 9, 2005
Loading...

Share This Page