I would like to create a table with the constructor method JTable(TableModel). What exact methods in the TableModel do I need to display the titles of each column?
                +1 
                A: 
                
                
              You need to embed your JTable within a JScrollPane and the column headings will be shown automatically:
JScrollPane sp = new JScrollPane(new JTable());
                  Adamski
                   2010-01-22 10:55:37
                
              Thanks Adamski. There is however a small problem: I am using the GridBagLayout. when I add the JScrollPane with the JTable embedded to the container with this layout, the JTable is reduced to a very small size. I still did not manage to understand why....
                  Tony
                   2010-01-22 11:12:30
                Have you added the scrollpane with the appropriate fill, weightx and weighty values?
                  willcodejavaforfood
                   2010-01-22 11:23:19
                the values you need are fill=GridBagConstraints.BOTH and weigthx and weighty values need to be relatively big in relation to the sum of theese values in their respective row/column.Ideally weigthx  and weighty for the jscrollpane will be 1 (in base 1) and 0 in the rest of the components in the same row/column
                  Telcontar
                   2010-01-22 11:47:28
                Many thanks for the help
                  Tony
                   2010-01-22 11:59:28
                
                
                A: 
                
                
              
            You need to implement a TableModel for example by extending the class AbstractTableModel or by to using a DefaultTableModel. This later has a constructor where you can set the number and names of your columns.
                  Pierre
                   2010-01-22 11:14:39
                
              
                
                A: 
                
              
            
                  sateesh
                   2010-01-22 11:16:16
                
              
                
                A: 
                
                
              
            I think what you are really looking for the is the class DefaultTableModel. Just read through the documentation and you will be on your own way.
                  ultrajohn
                   2010-01-22 11:23:35