settings columnnames of jtable:

Discussion in 'Java' started by t12be, May 3, 2004.

  1. t12be

    t12be Guest

    I'm trying to localize the columnames in a jtable. I used an
    AbstractTableModel to create this table.
    A quest throw the API didn't help me out. I found methods like
    setTableHeader() but these used objects other than Strings to adjust
    these columnNames.

    Anyone who knows how to do this please email me at:


    thx
     
    t12be, May 3, 2004
    #1
    1. Advertisements

  2. Hi someone,
    overwrite getColumnName(int column) in your model:

    e.g
    class MyTableModel extends AbstractTableModel {
    private String columNames[];

    // some code
    // initialization of columnNames
    // ...

    public String getColumnName( int column ) {
    return columnNames[column];
    }
    }

    Bye
    Michael
     
    Michael Rauscher, May 4, 2004
    #2
    1. Advertisements

  3. t12be

    t12be Guest

    Yep works. Thank a lot for helping me out, strungeld a long time not
    realising the solution would be that simple.

    greatings
    t12be
     
    t12be, May 4, 2004
    #3
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.