Fixed jtable column headers

Does anyone have an example of fixing column headers for a JTable. Basically I want the column headers to be displayed when scrolling down the table.

check the examples provided in "How to use table" -
"http://java.sun.com/docs/books/tutorial/uiswing/components/table.html"
The tables have fixed column header when u scroll down..

Similar Messages

  • JTable column headers not displaying using custom table model

    Hi,
    I'm attempting to use a custom table model (by extending AbstractTableModel) to display the contents of a data set in a JTable. The table is displaying the data itself correctly but there are no column headers appearing. I have overridden getColumnName of the table model to return the correct header and have tried playing with the ColumnModel for the table but have not been able to get the headers to display (at all).
    Any ideas?
    Cheers

    Class PublicationTableModel:
    public class PublicationTableModel extends AbstractTableModel
        PublicationManager pubManager;
        /** Creates a new instance of PublicationTableModel */
        public PublicationTableModel(PublicationManager pm)
            super();
            pubManager = pm;
        public int getColumnCount()
            return GUISettings.getDisplayedFieldCount();
        public int getRowCount()
            return pubManager.getPublicationCount();
        public Class getColumnClass(int columnIndex)
            Object o = getValueAt(0, columnIndex);
            if (o != null) return o.getClass();
            return (new String()).getClass();
        public String getColumnName(int columnIndex)
            System.out.println("asked for column name "+columnIndex+" --> "+GUISettings.getColumnName(columnIndex));
            return GUISettings.getColumnName(columnIndex);
        public Publication getPublicationAt(int rowIndex)
            return pubManager.getPublicationAt(rowIndex);
        public Object getValueAt(int rowIndex, int columnIndex)
            Publication pub = (Publication)pubManager.getPublicationAt(rowIndex);
            String columnName = getColumnName(columnIndex);
            if (columnName.equals("Address"))
                if (pub instanceof Address) return ((Address)pub).getAddress();
                else return null;
            else if (columnName.equals("Annotation"))
                if (pub instanceof Annotation) return ((Annotation)pub).getAnnotation();
                else return null;
            etc
           else if (columnName.equals("Title"))
                return pub.getTitle();
            else if (columnName.equals("Key"))
                return pub.getKey();
            return null;
        public boolean isCellEditable(int rowIndex, int colIndex)
            return false;
        public void setValueAt(Object vValue, int rowIndex, int colIndex)
        }Class GUISettings:
    public class GUISettings {
        private static Vector fields = new Vector();
        private static Vector classes = new Vector();
        /** Creates a new instance of GUISettings */
        public GUISettings() {
        public static void setFields(Vector f)
            fields=f;
        public static int getDisplayedFieldCount()
            return fields.size();
        public static String getColumnName(int columnIndex)
            return (String)fields.elementAt(columnIndex);
        public static Vector getFields()
            return fields;
    }GUISettings.setFields has been called before table is displayed.
    Cheers,
    garsher

  • Cant see jtable column headers

    I have my jtable in a container and i am displaying that container in a jframe. I cant see the table column headers. I cant use a jscrollpane and need to make the table headers visible. I can see the table fine with all its information in it. When I do a System.out.println(TableModel.getColumnName(int)); i get the correct column header name so I know that the column headers are existing. I would appreciate any help that you can give

    the last answer did not help me out. I reposted this with more information, such as i am placing my table in a container and not in a scrollpane. I added the code below and it still did not work
    content.add(jt.getTableHeader(), BorderLayout.NORTH);
    content.add(jt, BorderLayout.CENTER);
    I can still only see the table. I pasted code below where I create my table and repaint it. I have it set up where my table is in a JPanel. I have is set up so that I can move it around and resize it with the mouse. This all works and I can see the table but there are no headers.
    public FigTable(DefaultTableModel inTableModel, LEditor inLEditor)
              super(50, 50, 350, 200);
              setLineColor(Color.blue);
              setFillColor(ColorMenu.kColorOfNoFill);
              fEditor = inLEditor;
              content = fEditor.getGEFPanel().getDrawingPanel();
              importTable(inTableModel);
              fEditor.init();
              fEditor.inval();
    public void importTable(DefaultTableModel inTableModel)
              jt = new JTable(inTableModel);
              tRows = jt.getRowCount();
              tColumns = jt.getColumnCount();
              content.add(jt, BorderLayout.CENTER);
              content.add(jt.getTableHeader(), BorderLayout.NORTH);
    public void paint(Graphics g)
              jt.setBounds(_x, y, w, _h);
              if (_h >= tRows && tRows != 0)
              jt.setRowHeight(_h / tRows);
              if (isSelected())
                   drawHandles(g);
              if (_filled && (getFillColor() != null))
                   jt.setBackground(getFillColor());
              if (getLineColor() != null)
                   jt.setGridColor(getLineColor());
                   jt.setBorder(BorderFactory.createLineBorder(getLineColor()));
         }

  • Export JTable Column headers to Excel document

    Hello all!!! I am having a small problem while trying to export some data from a jTable to an excel document.
    I have a jTable and I use a custom TableModel with this:
    private String[] columnNames = {"First", "Second", "Third", "Forth"};as names for each column of the table.
    The thing I am trying to do is to export exactly the same "headers" from the columns of the jTable to the excel spreadsheet using Jakarta POI. Unfortunately I don't know how to do it and I haven't found anything yet on this forum. Can anyone help me with this?
    In simple words I want to know how I can have the same headers from my jTable columns, with the headers from the excel doument I will create.
    Many thanks in advanve!!!
    Kostas

    Thank you for your reply first of all. The problem is how to get the heading text and how to put it to the excel's first row OR to excels "headings" (if it is possible...). [in other words replace A,B,C,D from the excel document with the headers I get from the jTable...] .
    I hope now you can see what I am looking for... If there is no solution to this please tell me what are the alternatives. (B) could be a good example.
    Thanks you very much!!
    Kostas

  • JTable column headers missing

    I created a JTable using:
    JTable table = new JTable(v,cN);
    where v is my vector that holds the data and cN is a vector to hold the column names as below:
    Vector cN = new Vector();
         cN.add("Registry Keys");
         cN.add("Program Name");
         cN.add("Key Type");
         cN.add("Drive");
         cN.add("Location");
         cN.add("Leave");It displays the table fine with the data and as I add or remove entries in the cN vector it adds and removes columns - but doesn't display column headers? Any help appreciated.

    Are you using a scrollpane? If not, you have to get the Table Header component and place it appropriately.

  • JTable Column Headers are Squashed!

    Hi there,
    I'm using JBuilder, and have created a simple enough JTable that I place inside a JScrollPane. I am using my own implementation of the AbstractTable model.
    When I run the code, the Column headers are only about 5 pixels high! I have hunted around the JBuilder code (which if you have used JBuilder you will know is extensive!), but it doesn't seem to be doing anything extraordinary.
    So has anyone else had this problem? If so, what did you do to rectify.
    Yours hopefully
    Richard

    Hello there, my abstract implementation looks a little like this:
      public static final String columns[] = { "", "Request Id", "Date", "Component Name", "Version", "Type" };
      public String getColumnName(int columnIndex) {
        return columns[columnIndex];
      public Class getColumnClass(int columnIndex) {
        if (columnIndex == 0) {
          return Boolean.class;
        } else if (columnIndex == 1) {
          return Integer.class;
        } else {
          return String.class;
      }Thanks
    Richard

  • JTable Column Headers

    I want to create a JTable so that the table doesn't have any column headers. Right now I am using my own implementation of the AbstractTableModel Class for use with the tables, but if I leave out the public String getColumnName(int col) method, it makes the headers A, B, C, ... and if I set the column headers up with a blank String, it leaves an obvious thin empty header at the top. Any suggestions on how I can completely leave the column headers off?

    call the method on JTable
    table.setTableHeader(null);
    that will do the trick;
    cheers
    krishna

  • JTable column headers not showing up

    I have a JTable inside a JScrollPane which, in turn, is inside a JTabbedPane.
    I created a TableModel which extends AbstractTableModel as per the java Swing Tutorial examples.
    In that model is an Object[][] object for the data called rowData, and all the data displays in the table perfectly.
    I also have a String[] object called columnNames to define the column headers. ..the column names are coded directly into the object.
    i.e.: String[] columnNames = {"John", "Janet", "Jamie", "Jennifer"};But the column names don't display at all.....all I get in the column headers is 'A', 'B', 'C', etc.
    I need to know either
    1)how to set this up correctly in the first place or
    2)how I can reset the columns manually.
    I have tried adding the table 2 ways..as follows...but neither one gets the headers right:
    JScrollPane jScrollPane = new javax.swing.JScrollPane(getTable());or
    JScrollPane jScrollPane.setViewportView(getTable());Note: getTable()..is where the new javax.swing.JTabel(new TableModel())stuff is done.
    thx, ESW

    You mentioned the you columnNames array. I suggest you declare it as static and accessible from within your custom table modelprivate static final String[] COLUMN_NAMES = {"John", "Janet", "Jamie", "Jennifer"};Then you override/implement the following methods in your TableModel :public String getColumnName(int column) {
         return COLUMN_NAMES[column];
    public int getColumnCount() {
         return COLUMN_NAMES.length;
    }That should do the trick.

  • JTable column headers missing..kindly help...

    Hello there!
    I have written a program that ultimately deals with database connectivity, but my problem is got more to do with JTable. that's why i decided to post my doubt here.
    my program displays a JTable by reading fields form a database.
    But you see, the column headers are missing!!
    I have used the concept of DefaultTableModel, i first searched google and came upon a website: www.exampledepot.com and studied the sample codes on how insert fields into a JTable using the above....
    i swear to god i have done the exact same things..
    Could you please help me out??
    Thankyou very much and have a great day!
    :-)

    done that alreadyThen your problem is solved?
    Or does that mean that you had already done it and no headings showed up? In that case there's something wrong with your code.
    And Swing questions should be posted in the Swing forum.

  • Can we fix the column headers of a table placed in a scroll container?

    Hi
      I have a big table placed inside a scroll container.
      The table is so big that both horizontal and vertical scroll bars appears always.
      So what happens is...
         when the user moves the vertical scrollbar down, the column headers move
         up,so that they are no visible, when he reaches the bottom of the table.
    What is our requirement is, even if the  user moves the vertical scrollbars the headers should be visible.
    Can anybody solve this problem??
    Thanks
    Smitha

    hi Smitha,
        We cannot avoid that. but an alternate is that use another table above this table and which has the number of rows as zero. hide the table header for the below table. you need to adjust the header of above table so that it fits for the below table.
    This works fine if the table doesn't have sorter facility.
    Regards,
    Gopi

  • Almost invisible JTable column headers

    I'm writing an applet which contains a JTable within a JScrollPane. For a while the column headings (text) were visible, but recently the column headings have become very small in height. There is barely enough there so that the mouse can be used to sort, or resize or reorder the columns, but the text can not be seen. It doesn't seem to be related to the number of rows in the table. The getColumnName() method is being called and returning the correct strings, but they don't show up on the screen. As I said, this was working ok until recently, and I don't know what I changed that might have caused it.
    Any ideas? Thanks ... John Lawrence

    I am trying to have a JTable with variable height header. I give the headers a renderer that parses the text into a vector (breaking it into lines), and then returns a JList populated with the vector.
    ex: if the text is "Line1\nLine2", the header will have double height, with two lines:
    Line1
    Line2
    The problem is the same that you encountered: Swing only looks at the header of the 1st column to determine the height of all! So if there are headers with more lines than the 1st one, they get chopped!
    Does anybody know a workaround?

  • Autofit JTable column headers

    I have a problem. I am using eclipse. What i want to do is that in a Jtable, i want such a mechanism that no matter what the table headers are(any font, size), the jtable adjusts the column width to show the whole table header. The headers and the fonts are read from a file.
    presently i m doing this:
    //used to set the column widths
    FontMetrics metrics = tbl.getFontMetrics(tbl.getFont());
    // Set column widths
    int tempWidth;
    for (int i=0; i<columnNames.length ; i++)
    tempWidth = metrics.stringWidth(tbl.getColumnName(i))+ (2 * tbl.getColumnModel().getColumnMargin());
    tcm.getColumn(i).setPreferredWidth(tempWidth);
    tcm.getColumn(i).setPreferredWidth(columnNames.length()*7);
    The problem is that this does not work for all fonts.
    Can ne 1 plz provide sample code???

    Here's the full code I posted before to do this.
    It resizes the entire JTable to fit the column size, no matter what font properties, and
    optionally includes using the column header as well.
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=606240
    regards,
    Owen

  • Saving JTable column headers

    I an writing a program in which I am trying to save a table. I can save all of the data from in the table by sending the TableModel to a file, but I cannot get the headers to save. I have tried saving the JTableHeader and am currently trying it by saving the TableColumnModel.
    This is the code for the saving and loading of the headers:
      * Save Header
      * @param pathname The relative path and filename
      * @return Returns true if successful, false if not
      public boolean saveHeader(String pathname){
        //if(table.getModel().getValueAt(table.getSelectedRow(), table.getSelectedColumn()).equals(null))
          //table.getModel().setValueAt("",table.getSelectedRow(), table.getSelectedColumn());
        if(!(table.getSelectedColumn() == 0)) table.setColumnSelectionInterval(0,0);
        /*try{
          if (table.isEditing()) { //To keep last value while saving
            TableCellEditor tc = table.getCellEditor();
            // To cancel the editing
            //tc.cancelCellEditing();
            // Or to keep the editor's current value
            if(tc != null)tc.stopCellEditing();
        catch(Exception d){
          d.printStackTrace();
        try{
          FileOutputStream fos2 = new FileOutputStream(pathname + "/attendanceheader.dat");
          ObjectOutputStream oos2 = new ObjectOutputStream(fos2);
          TableColumnModel tcm = (TableColumnModel)table.getColumnModel();
          oos2.writeObject(tcm);
            //oos.writeObject(tm);
          oos2.close();
          fos2.close();
          table.setFocusable(true);
        catch(Exception e){
          System.out.println(e.getMessage());
          return false;
        return true;
       * Load a file header
       * @param pathname The relative path and filename
       * @return Returns true if successful, false if not
      public boolean loadHeader(String pathname){
        //create a JTableHeader to hold the model of the header
        TableColumnModel tcm = null;
        try{
          //create FileInputStream and ObjectInputStream go get the table header
          FileInputStream fis2 = new FileInputStream(pathname +
                                                     "/attendanceheader.dat");
          ObjectInputStream ois2 = new ObjectInputStream(fis2);
          //get the JTableHeader from the file
          tcm = (TableColumnModel) (ois2.readObject());
          //set the JTableHeader and close the input streams
          table.setColumnModel(tcm);
          ois2.close();
          fis2.close();
        catch(Exception e){
          try{
            //try to make the file if it didnt exist
            File outputFile2 = new File(pathname + "/attendanceheader.dat");
            if(outputFile2.exists()) throw e;
            else{
              JTable temp = new JTable(table.getRowCount(), table.getColumnCount());
              table.setColumnModel(temp.getColumnModel());
              table.getColumnModel().getColumn(0).setHeaderValue("Last Name, First Name");
              saveHeader(pathname);
          catch(Exception f){
            System.out.println(e.getMessage());
            System.out.println(f.getMessage());
            return false;
        return true;
      }This is the exception I get:
    Exception occurred during event dispatching:
    java.lang.NullPointerException
         at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:939)
         at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
         at javax.swing.JComponent.paintComponent(JComponent.java:541)
         at javax.swing.JComponent.paint(JComponent.java:808)
         at javax.swing.JComponent.paintChildren(JComponent.java:647)
         at javax.swing.JComponent.paint(JComponent.java:817)
         at javax.swing.JViewport.paint(JViewport.java:707)
         at javax.swing.JComponent.paintChildren(JComponent.java:647)
         at javax.swing.JComponent.paint(JComponent.java:817)
         at javax.swing.JComponent.paintChildren(JComponent.java:647)
         at javax.swing.JComponent.paint(JComponent.java:817)
         at javax.swing.JComponent.paintChildren(JComponent.java:647)
         at javax.swing.JComponent.paint(JComponent.java:817)
         at javax.swing.JComponent.paintChildren(JComponent.java:647)
         at javax.swing.JComponent.paint(JComponent.java:817)
         at javax.swing.JLayeredPane.paint(JLayeredPane.java:552)
         at javax.swing.JComponent.paintChildren(JComponent.java:647)
         at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4778)
         at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4724)
         at javax.swing.JComponent.paint(JComponent.java:798)
         at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
         at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
         at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
         at java.awt.Container.paint(Container.java:1309)
         at javax.swing.JFrame.update(JFrame.java:385)
         at sun.awt.RepaintArea.paint(RepaintArea.java:169)
         at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260)
         at java.awt.Component.dispatchEventImpl(Component.java:3699)
         at java.awt.Container.dispatchEventImpl(Container.java:1623)
         at java.awt.Window.dispatchEventImpl(Window.java:1590)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:140)
         at java.awt.Dialog.show(Dialog.java:538)
         at javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:822)
         at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:624)
         at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:595)
         at EGA.UseGroup.actionPerformed(UseGroup.java:414)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:289)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1113)
         at javax.swing.plaf.basic.BasicMenuItemUI$MenuDragMouseHandler.menuDragMouseReleased(BasicMenuItemUI.java:1006)
         at javax.swing.JMenuItem.fireMenuDragMouseReleased(JMenuItem.java:585)
         at javax.swing.JMenuItem.processMenuDragMouseEvent(JMenuItem.java:482)
         at javax.swing.JMenuItem.processMouseEvent(JMenuItem.java:429)
         at javax.swing.MenuSelectionManager.processMouseEvent(MenuSelectionManager.java:274)
         at javax.swing.plaf.basic.BasicMenuUI$MouseInputHandler.mouseReleased(BasicMenuUI.java:344)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:227)
         at java.awt.Component.processMouseEvent(Component.java:5134)
         at java.awt.Component.processEvent(Component.java:4931)
         at java.awt.Container.processEvent(Container.java:1566)
         at java.awt.Component.dispatchEventImpl(Component.java:3639)
         at java.awt.Container.dispatchEventImpl(Container.java:1623)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
         at java.awt.Container.dispatchEventImpl(Container.java:1609)
         at java.awt.Window.dispatchEventImpl(Window.java:1590)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
    javax.swing.JTable$CellEditorRemover
    I could really use some help here...this is frustrating as all get out
    Thanks!

    wow!!!! I guess posting to this forum really got my brain going and I think it's working just great now!
    I figured out i was throwing some wrong exceptions, so i made exceptions that threw the message "Fine" to know when an exception was good. I used the finction table.removeEditor() to get rid of the TableEditorRemover error. I'll post the updated code for you all!
      * Attendance Save Header
      * @param pathname The relative path and filename
      * @return Returns true if successful, false if not
      public boolean saveHeader(String pathname){
        //if(table.getModel().getValueAt(table.getSelectedRow(), table.getSelectedColumn()).equals(null))
          //table.getModel().setValueAt("",table.getSelectedRow(), table.getSelectedColumn());
        //if(!(table.getSelectedColumn() == 0)) table.setColumnSelectionInterval(0,0);
        /*try{
          if (table.isEditing()) { //To keep last value while saving
            TableCellEditor tc = table.getCellEditor();
            // To cancel the editing
            //tc.cancelCellEditing();
            // Or to keep the editor's current value
            if(tc != null)tc.stopCellEditing();
        catch(Exception d){
          d.printStackTrace();
        try{
          FileOutputStream fos2 = new FileOutputStream(pathname + "/attendanceheader.dat");
          ObjectOutputStream oos2 = new ObjectOutputStream(fos2);
          table.removeEditor();
          TableColumnModel tcm = (TableColumnModel)table.getColumnModel();
          oos2.writeObject(tcm);
            //oos.writeObject(tm);
          oos2.close();
          fos2.close();
          table.setFocusable(true);
        catch(Exception e){
          System.out.println(e.getMessage());
          e.printStackTrace();
          return false;
        return true;
       * Load a file header
       * @param pathname The relative path and filename
       * @return Returns true if successful, false if not
      public boolean loadHeader(String pathname){
        //create a JTableHeader to hold the model of the header
        TableColumnModel tcm = null;
        try{
          //create FileInputStream and ObjectInputStream go get the table header
          FileInputStream fis2 = new FileInputStream(pathname +
                                                     "/attendanceheader.dat");
          ObjectInputStream ois2 = new ObjectInputStream(fis2);
          //get the JTableHeader from the file
          tcm = (TableColumnModel) (ois2.readObject());
          //set the JTableHeader and close the input streams
          table.setColumnModel(tcm);
          ois2.close();
          fis2.close();
        catch(Exception e){
          try{
            //try to make the file if it didnt exist
            File outputFile2 = new File(pathname + "/attendanceheader.dat");
            if(outputFile2.exists()) throw new Exception("Fine");
            else{
              JTable temp = new JTable(table.getRowCount(), table.getColumnCount());
              table.setColumnModel(temp.getColumnModel());
              table.getColumnModel().getColumn(0).setHeaderValue("Last Name, First Name");
              saveHeader(pathname);
          catch(Exception f){
            System.out.println(e.getMessage());
            System.out.println(f.getMessage());
            if(f.getMessage().equals("Fine")) return true;
            return false;
        return true;
      }

  • JTable auto size columns/headers

    How do I autoresize a JTable column/headers so that each column/header is the minium size necessary.
    I've tried setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); and that doesn't
    seem to work.
    Thanks

    You need to calculate the width of the text and set the preferred size of each column.
    If seen solutions posted in the forum (but no I don't know the exact posting) so you can search the forum to find them.

  • How to change JTable column header text

    How do you set the text in the JTable column headers? I know you can create a JTable specifying the text in an array:
    <li>JTable(Object[][] rowData, Object[] columnNames)
    But if you create the JTable specifying a TableModel,
    <li>JTable(TableModel dm)
    the header text defaults to "A", "B", "C", etc. I cannot figure out how to access the text in the header names so it can be changed to something useful. I know how to get the JTableHeader for the table, but it does not seem to have methods for actually setting header values.

    I'm sure that model allows you to specify header values so you don't have to do so manually. I would be very surprised if it didn't override the default getColumnName() method to provide a reasonable names.She wasn't writing the class, but [url http://forums.oracle.com/forums/thread.jspa?messageID=9200751#9200751]outlining a design for me to implement. And, based on a previous comment I had made, I think she assumed I wanted the new design to look as much like the old as possible. There were no headers in the original design, which wasn't even a table.
    Anyway, this works:
        final static String statisticsColumnNames[] = {
         "Type", "Count",
         "Red QE", "Green QE", "Blue QE", "Average QE",
         "Distance"
         qErrors = new QEBeanTableModel();
         JTable errorTable = new JTable(qErrors);
         TableColumnModel tcm = errorTable.getColumnModel();
         for (int col = 0; col < statisticsColumnNames.length; col++)
             tcm.getColumn(col).setHeaderValue(statisticsColumnNames[col]);
    It looks like setHeaderValue() on the TableColumn is what I was looking for.Again, only used if you are dynamically changing the values at run time or you don't like the defaults provided by the Bean-aware model.I coded the above before I read your last post. The QEBeanTableModel is extremely specific to my program. I.e. I cannot imagine it being used anywhere else. Would it still be better to implement a getColumnName() within the table model? Looking at your [url http://www.camick.com/java/source/RowTableModel.java]RowTableModel.java source, I can see that it would not be difficult to do so.
    Just decided to add the getColumnName() method. This whole sub-project is based on implementing a clean modern design (and learning about Java Beans). You've clearly stated twice that the method I have implemented is for dynamic header values only, which has already answered what I asked last paragraph.

Maybe you are looking for

  • Help needed in building a tree without duplicatin​g the nodes

    Iam trying to construct a tree, ID name as the parent node and channel name & channel values as its corresponding child nodes. I had constructed the tree, but the problem i have is with interfacing that with in my  main program. In the main program s

  • SQLFORMS/REPORTS 6i  still supported on DB version 10.1.0.5?

    hi, do you know if Oracle is still supporting SQLFORMS/REPORTS 6i on an Oracle DB version 10.1.0.5? What is the latest working version of the DB that can be used with SQLFGRMS/REPORTS 6i thank you, Cami

  • Treasury Business content

    Hi SDN, I have to create BI reports based on Treasury module - Cash management, Liquidity planning I have installed business content DS, Infocubes and loaded data from R/3. But I am not seeing any relevant data required for reporting. And also I don'

  • How to create a spool?

    Hi, some answers would be greatly appreciated. In an ABAP program there is this internal table full of data, and I have to write its contents into a PDF. The only way it seems is to make a spool and then use CONVERT_ABAPSPOOLJOB_2_PDF function to con

  • FCP Files in PP ...overall acceptance

    Did a fair amout of search, but I'm still not clear on this issue... Just upgraded to CS4 in large part because I need to bridge a huge gap I have in finding freelance editing gigs with all that raw video out there that has been captured using FCP. I