Results 1 to 3 of 3
  1. #1
    Levish2002 is offline Member
    Join Date
    Aug 2008
    Posts
    4
    Rep Power
    0

    Default Swing problem: JTable/TableModel

    hello

    I've got a class that implements TableModel and when loading an object of that class to a JTable I was hoping that I would see the Column Names of that table:

    the following code appears in the class the implements TableMode:

    private static String[] ColumnName = {"Number", "FileName", "LineNumber", "Error"};

    @Override
    public String getColumnName(int columnIndex) {
    return CompilationErrors.ColumnName[columnIndex];
    }

    I've checked and this method is called as expected.

    however : I don't see any column names :(

    Anyone can help ?

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    Did you add the JTable to a JScrollPane?
    If not you'll have to add the JTableHeader to the tables parent Container as a separate component.

  3. #3
    Levish2002 is offline Member
    Join Date
    Aug 2008
    Posts
    4
    Rep Power
    0

    Default

    Quote Originally Posted by hardwired View Post
    Did you add the JTable to a JScrollPane?
    If not you'll have to add the JTableHeader to the tables parent Container as a separate component.
    hey, thanks for the swift reply

    i've added the JScrollPane and it fixed it :-)
    (didn't know that Pane at all before you mentioned it)

    thx again

Similar Threads

  1. JTABLE problem
    By MaximInf in forum AWT / Swing
    Replies: 4
    Last Post: 06-21-2008, 10:45 AM
  2. JTable problem
    By robbertds1 in forum AWT / Swing
    Replies: 1
    Last Post: 05-20-2008, 06:34 PM
  3. Replies: 2
    Last Post: 05-15-2008, 10:15 AM
  4. Create different instance of a tablemodel
    By Bill in forum AWT / Swing
    Replies: 6
    Last Post: 03-27-2008, 03:49 PM
  5. Problem with JTable
    By Felissa in forum AWT / Swing
    Replies: 2
    Last Post: 07-04-2007, 09:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •