I want my JTable's headers do nothing!

HI
I have a JTable, and I listen when any cell has been stopped editing, I validate its content and throw a message if it's invalid.
All works fine when i click on any cell (or any other component then I cancel editing), but when i click on any of the column headers the editing cell just gets the value (and of course if it's invalid it takes it anyway).
i've tried:
-table.getTableHeader().setFocusable(false);
-table.getTableHeader().setEnabled(false);
-table.setTableHeader() = null; (i really need a header cos i catch column selection events)
So I think this is caused by some action that column headers do when clicked.
*How do i override or avoid column headers from doing anything?
* setFocusable(fasle) should work, am I applying it to the right object?
Thanks!!!

Well, it actually loses focus, I've seen it enter into the lost focus event's method (loses focus because i have when editing the focus is owned by the cellEditor), I 've compared objects and table headers are taken as the same object as the table.
It would be perfect if it would anything but I think it really does some things when is pressed, specifically it stops the editing of any cell.
I would like to know how to stop table headers from doing that.
Thanks in advance! =)

Similar Messages

  • Add JTable Row Headers At The End Of The Rows(At Right)?

    hi all
    i got this example for adding JTable Row Headers,but it adds the headers at the left(beginning of the row)
    and i want to add the headers at the end of the row(at right),any ideas how to do that?
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.AbstractListModel;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.ListCellRenderer;
    import javax.swing.ListModel;
    import javax.swing.UIManager;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.JTableHeader;
    * @version 1.0 11/09/98
    class RowHeaderRenderer extends JLabel implements ListCellRenderer {
      RowHeaderRenderer(JTable table) {
        JTableHeader header = table.getTableHeader();
        setOpaque(true);
        setBorder(UIManager.getBorder("TableHeader.cellBorder"));
        setHorizontalAlignment(CENTER);
        setForeground(header.getForeground());
        setBackground(header.getBackground());
        setFont(header.getFont());
      public Component getListCellRendererComponent(JList list, Object value,
          int index, boolean isSelected, boolean cellHasFocus) {
        setText((value == null) ? "" : value.toString());
        return this;
    class RowHeaderExample extends JFrame {
      public RowHeaderExample() {
        super("Row Header Example");
        setSize(370, 150);
        ListModel lm = new AbstractListModel() {
          String headers[] = { "Row1", "Row2", "Row3", "Row4"};
          public int getSize() {
            return headers.length;
          public Object getElementAt(int index) {
            return headers[index];
        DefaultTableModel dm = new DefaultTableModel(lm.getSize(), 4);
        JTable table = new JTable(dm);
        table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        table.setRowHeight(18);
        JList rowHeader = new JList(lm);
        rowHeader.setFixedCellWidth(50);
        rowHeader.setFixedCellHeight(18);
        rowHeader.setCellRenderer(new RowHeaderRenderer(table));
        JScrollPane scroll = new JScrollPane(table);
        scroll.setRowHeaderView(rowHeader);
        getContentPane().add(scroll, BorderLayout.CENTER);
      public static void main(String[] args) {
        RowHeaderExample frame = new RowHeaderExample();
        frame.addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
        frame.setVisible(true);
    }

    fixed by:
    list.setBackground(table.getTableHeader().getBackground());here's the full code:
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.ComponentOrientation;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.DefaultListModel;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.ListCellRenderer;
    import javax.swing.UIManager;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.JTableHeader;
    * @version 1.0 11/09/98
    class RowHeaderRenderer extends JLabel implements ListCellRenderer {
      JTable table;
      RowHeaderRenderer(JTable table) {
        this.table = table;
        JTableHeader header = table.getTableHeader();
        setOpaque(true);
        setBorder(UIManager.getBorder("TableHeader.cellBorder"));
        setHorizontalAlignment(CENTER);
        setForeground(header.getForeground());
        setBackground(header.getBackground());
        setFont(header.getFont());
      public Component getListCellRendererComponent(JList list, Object value,
          int index, boolean isSelected, boolean cellHasFocus) {
        list.setBackground(table.getTableHeader().getBackground());
        setText((value == null) ? "" : value.toString());
        return this;
    class RowHeaderExample extends JFrame {
      public RowHeaderExample() {
        super("Row Header Example");
        setSize(370, 150);
        setLocationRelativeTo(null);
        DefaultListModel lstModel = new DefaultListModel();
        lstModel.addElement("Row 1");
        lstModel.addElement("Row 2");
        lstModel.addElement("Row 3");
        lstModel.addElement("Row 4");
        DefaultTableModel dm = new DefaultTableModel(lstModel.getSize(), 4);
        JTable table = new JTable(dm);
        table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        table.setRowHeight(18);
        JList rowHeader = new JList(lstModel);
        rowHeader.setFixedCellWidth(50);
        rowHeader.setFixedCellHeight(18);
        rowHeader.setCellRenderer(new RowHeaderRenderer(table));
        JScrollPane scroll = new JScrollPane(table);
        scroll.setRowHeaderView(rowHeader);
        table.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
        scroll.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
        getContentPane().add(scroll, BorderLayout.CENTER);
      public static void main(String[] args) {
        RowHeaderExample frame = new RowHeaderExample();
        frame.addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
        frame.setVisible(true);
    }

  • HT3951 where to type the name of a song I want to buy, at store page nothing seems to be interactive. Thanks

    Where to type the name of a song I want to buy, at store page nothing seems to be interactive.
    Thanks
    Vladimir

    You should have a search box at the top right of iTunes :
    When you are browsing the store that box searches the store, when you are looking at your library it searches that.

  • I want to have different headers in Pages. I want to be able to set them and not have them be the same. For example I want ii then iii and so on...How do I do that?

    I want to have different headers in Pages. I want to be able to set them and not have them be the same. For example I want ii then iii and so on...How do I do that?

    Hi BelleDesign,
    "Headers" is short for "Continuing Headers."
    Use a Header when you want recurring information on a series of pages in your document.
    If ii, iii, etc. are page numbers, you can place them in Headers using Insert > Page Number, then formatting the page number to lower case Roman numerals.
    For more on Headers and Footers, see Chapter 3, Working with document parts in the Pages '09 User Guide, available for download via the Help menu in Pages. Discussion of Headers and Footers starts on Page 54.
    Regards,
    Barry

  • 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

  • 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

    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 without headers - column resizing

    I have a simple problem: a JTable with 3 columns, and NO HEADERS.
    I want the middle column ONLY to be resized when the WINDOW is resized. The other two columns should remain of fixed size.
    Is there a simple answer?
    Many thanks for any help,
    george33

    Thank you Thomas for your prompt reply. I have eliminated the headers and automatic resizing using:
    myTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    JTableHeader th=myTable.getTableHeader();
    th.setReorderingAllowed(false);
    th.setResizingAllowed(false);
    jth.setPreferredSize(new Dimension(0, 0)); //remove headers
    This works fine as far as eliminating resizing of all columns and removing the headers.
    What I cannot work out is how to ensure that only the middle column is resized when the window is resized.
    You refer to a component listener. Which componenent should I attach the listener to?
    How can I make two columns of fixed size and one of variable size, and only when the window is resized?
    thanks for your help
    George33

  • 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..

  • JTable  with headers extending JDialog

    I am creating a class file extending JDialog. I have populated the JTable on the form and want to include headers on the table. The dialog form opens and the table is visible and populated but with no headers. Has anyone had success with headers on JTables when creating a JDialog object?
    I have other tables created with headers so I wondered if the problem was with JDialog?

    inorder to make headers visible you need to add scroll pane to table,
    either by:
    JScrollPane scrollPane = JTable.createScrollPaneForTable(table);
    or:
    scrollPane = new JScrollPane(table);
    unless there's no scroller, you can't see headers.

  • When I am re-installing the Mac OSX snow leopard onto an older Mac I run into the window that says select the disk where you want to install Mac OSX but nothing is there to select

    I am trying to re-install the Mac OSX snow leopard onto an older I mac with a new hard drive.  I run into the "select the disk "where you want to install Mac OSX but there is nothing in the window to select. Any advice?

    After you install a new hard drive, you need to boot to another drive to initialize it to MAC OS Extended (journaled) format and create the partition(s) on the drive. You do this using Disk Utility. Otherwise, the mac operating install process doesn't see a formatted disk to install to.

  • 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

  • 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?

  • 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()));
         }

  • 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;
      }

Maybe you are looking for

  • Set list permission with worflow

    I have two lists,  listA will be used by admin to add users with some required information , we need once admin added the user,  a contribute permission is added for user to listB. I'm trying to use sharepoint designer to accomplish this but all acti

  • Install Photoshop Elements 9 on new laptop?

    Hi, I have Photoshop Elements 9 on my old laptop and no longer have my disc but do have the serial number.  Can I install on a new laptop? Thanks!

  • Re-install LaserWriter 8.6.5+ to access printer utility?

    Apple gave me my Powerbook with a laser printer set up in Classic. I am trying to get into the Desktop printer utility but I get "Desktop printer can not run with out laserwrtr 8.6.5 or greater. You may need to enable it from the extensions mgr. or r

  • How to learn ERP well

    we are using oracle ERP(oracle application 11.5.8) works together with oracle database 8.1.7.4.0. i want to learn oracle ERP(oracle application 11.5.8) . but i don't know where to learn them such as om and ar and ap and gl and so on. who can tell me

  • Myriad Pro Font font not available?

    How do I get the Myriad Pro Font - there are a large amount not available?  Please help...