JTable - using a 2D vector with AbstractTableModel

Discussion in 'Java' started by Deshaies, Apr 20, 2004.

  1. Deshaies

    Deshaies Guest

    I have written a 2D vector class; vector of vectors; and would like to
    use it with the AbstractTableModel class. I have put an instance of
    the 2D vector class into the AbstractTableModel interface and have
    removed the static 2D array code.
    My problem is that the AbstractTableModel does not recognize the 2D
    vector as far as placing data from that vector into the table.

    Am I missing something somewhere?

    thanks, have a great day, JP
     
    Deshaies, Apr 20, 2004
    #1
    1. Advertising

  2. Deshaies wrote:
    > I have written a 2D vector class; vector of vectors; and would like to
    > use it with the AbstractTableModel class. I have put an instance of
    > the 2D vector class into the AbstractTableModel interface


    AbstractTableModel is a class, not an interface.

    > and have removed the static 2D array code.


    There is no such thing supposed to be removed from AbstractTableModel
    when you subclass it. Are you by any chance messing with some other
    class, or are you even messing with the source code of AbstractTableModel?

    > My problem is that the AbstractTableModel does not recognize the 2D
    > vector as far as placing data from that vector into the table.
    >
    > Am I missing something somewhere?


    We can only guess without seeing your source code. Maybe you messed up
    on line 32?

    And what about this statement from the API documentation:

    <quote>
    To create a concrete TableModel as a subclass of AbstractTableModel you
    need only provide implementations for the following three methods:

    public int getRowCount();
    public int getColumnCount();
    public Object getValueAt(int row, int column);
    </quote>

    Did you do that?

    /Thomas
     
    Thomas Weidenfeller, Apr 21, 2004
    #2
    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. Deshaies
    Replies:
    0
    Views:
    463
    Deshaies
    Apr 20, 2004
  2. Dinobe
    Replies:
    2
    Views:
    932
    Dinobe
    May 12, 2004
  3. Edward H. Fabrega
    Replies:
    11
    Views:
    2,977
    Tor Iver Wilhelmsen
    Sep 30, 2004
  4. Replies:
    0
    Views:
    371
  5. Replies:
    8
    Views:
    1,939
    Csaba
    Feb 18, 2006
Loading...

Share This Page