How to pass external input to user-defined subclasses???

Discussion in 'Java' started by Lorenzo, Jan 29, 2007.

  1. Lorenzo

    Lorenzo Guest

    Hi all,

    [this might be a really trivial question] I would like to define a sub-
    class of JTable which get some external inputs: something similar to
    the following *not-working* example.

    ***********************************************************************
    *****
    import javax.swing.*;
    import javax.swing.table.*;

    public class RHJTable extends JTable
    {
    public RHJTable(int rows, int columns, int externalinput)
    {
    super(rows, columns);
    }
    public Object getValueAt(int row, int column, int externalinput)
    {
    return externalinput;
    }
    }
    ***********************************************************************
    *****

    What follows is the error message I get, which I assume it is due to
    my "externalinput":

    ***********************************************************************
    *****
    ??? Java exception occurred:
    java.lang.ArrayIndexOutOfBoundsException: 0 >= 0

    at java.util.Vector.elementAt(Unknown Source)
    at javax.swing.table.DefaultTableColumnModel.getColumn(Unknown
    Source)
    at javax.swing.JTable.getCellRect(Unknown Source)
    at javax.swing.JTable.valueChanged(Unknown Source)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown
    Source)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown
    Source)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown
    Source)
    at javax.swing.DefaultListSelectionModel.changeSelection(Unknown
    Source)
    at javax.swing.DefaultListSelectionModel.changeSelection(Unknown
    Source)
    at
    javax.swing.DefaultListSelectionModel.removeSelectionIntervalImpl(Unkno
    wn Source)
    at
    javax.swing.DefaultListSelectionModel.removeSelectionInterval(Unknown
    Source)
    at javax.swing.JTable.checkLeadAnchor(Unknown Source)
    at javax.swing.JTable.tableChanged(Unknown Source)
    at javax.swing.JTable.setModel(Unknown Source)

    at javax.swing.JTable.<init>(Unknown Source)
    at javax.swing.JTable.<init>(Unknown Source)
    at javax.swing.JTable.<init>(Unknown Source)
    at RHJTable.<init>(RHJTable.java:12)
    ***********************************************************************
    *****

    Can anybody please suggest me the correct way of passing this external
    input?

    Thanks


    lor
     
    Lorenzo, Jan 29, 2007
    #1
    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. Oodini
    Replies:
    1
    Views:
    1,796
    Keith Thompson
    Sep 27, 2005
  2. Replies:
    1
    Views:
    518
    Sion Arrowsmith
    Jul 10, 2008
  3. Tricky
    Replies:
    0
    Views:
    592
    Tricky
    Mar 19, 2009
  4. Tricky
    Replies:
    0
    Views:
    1,028
    Tricky
    Mar 19, 2009
  5. Gareth Adams
    Replies:
    2
    Views:
    158
    Phrogz
    Dec 11, 2007
Loading...

Share This Page