Hi Kimberly,

I'm not sure if I have understood your problem, so please correct me if I
am wrong;
You are subclassing a Java class i Jython and wish to use this class
together with some other javax.swing class? It looks to me as if you are
working with your object through a limited interface, for instance through
javax.swing.table.TableModel which AbstractTableModel implements, or
through the public interface of AbstractTableModel itself. Which interface
you are working with depends on how you created your object (or got a hold
of it). I am unable to help you more without seeing more code...
Hope this helps

regards
Bent




> Perhaps this problem has been covered already, but I haven't been able
> to find the answer in documentation or user groups. I am using an
> abstract class called AbstractTableModel. To create a concrete
> TableModel as a sublcass of AbstractTableModel you need only provide
> implementations for the following three methods (which I've done):
>  public int getRowCount();
>  public int getColumnCount();
>  public Object getValueAt(int row, int column);
>
> Here is the jython class:
>
> class cMyTableData(swing.table.AbstractTableModel):
>    #----------------------------------------------------------
>    # __init__ Constructor
>    # Initializes all member data.
>    #
>    #----------------------------------------------------------
>    def __init__(self):
>        self.path = cColumnData(COLUMN_1, 50, swing.JLabel.LEFT)
>        self.lineno = cColumnData(COLUMN_2, 50, swing.JLabel.LEFT)
>        self.columns = [ self.path,self.lineno]
>        self.vector = java.util.Vector()
>        self.vector.removeAllElements()
>
>    def getColumnCount(self):
>           # code particular to my situation
>
>    def getRowCount(self):
>        # code particular to my situation
>
>    def getValueAt(self, nRow, nCol):
>       # code particular to my situation
>
>    #An additional function I've added...
>    def sortMyData(self, thing):
>        # blah, blah, blah...
>
> When I add sortData, to this class, I get an error: AttributeError:
> sortMyData
>
> Why does this particular class restrict me? Does anyone know? I have
> tried the same thing with AbstractList with success.
>
> Thanks in advance for any information,
> KD
>



Last ned dette som en fil

 
Forrige | Neste |  Delete & Prev | Delete & Next
Move to: