classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: The start of JTable support


From: Mark Wielaard
Subject: [cp-patches] FYI: The start of JTable support
Date: Sat, 04 Sep 2004 23:12:55 +0200

Hi,

This adds the start of the JTable support that Graydon has been working
on.

Graydon says: "it can now build up the data, column and selection
models, paint cells and headers (with variable lines and padding) and
respond to selections in the various selection modes. no editing of
cells and no drag-resizing of columns yet"

 2004-09-04  Graydon Hoare  <address@hidden>

       * javax/swing/Box.java: Fix setting of layout in ctor.
       * javax/swing/JScrollPane.java: Scroll headers as well.
       * javax/swing/JTable.java: Reimplement.
       * javax/swing/JViewPort.java: Only add non-null children.
       * javax/swing/ScrollPaneLayout.java: Correct header calculations.
       * javax/swing/Timer.java: Fix stopping null waker.
       * javax/swing/plaf/basic/BasicTableHeaderUI.java: New file.
       * javax/swing/plaf/basic/BasicTableUI.java: New file.
       * javax/swing/table/DefaultTableCellRenderer.java: Configure.
       * javax/swing/table/DefaultTableColumnModel.java: Flesh out.
       * javax/swing/table/DefaultTableModel.java: Clean up.
       * javax/swing/table/JTableHeader.java: Implement.

I have not yet added a Demo for this to our examples.
Playing a bit with it in JFreeChart (see about menu) shows that it is
not really ready yet.

Committed.

Mark
Index: javax/swing/Box.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/Box.java,v
retrieving revision 1.11
diff -u -r1.11 Box.java
--- javax/swing/Box.java        8 Aug 2004 12:51:41 -0000       1.11
+++ javax/swing/Box.java        4 Sep 2004 21:12:55 -0000
@@ -178,7 +178,7 @@
    */
   public Box(int axis)
   {
-    setLayout(new BoxLayout(this, axis));      
+    super.setLayout(new BoxLayout(this, axis));        
   }
   
   /**
Index: javax/swing/JScrollPane.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JScrollPane.java,v
retrieving revision 1.12
diff -u -r1.12 JScrollPane.java
--- javax/swing/JScrollPane.java        30 Jul 2004 20:21:19 -0000      1.12
+++ javax/swing/JScrollPane.java        4 Sep 2004 21:12:55 -0000
@@ -509,7 +509,8 @@
           else
             {
               // otherwise we got a change update from either the VSB or
-              // HSB model, and we need to update the viewport position to
+              // HSB model, and we need to update the viewport positions of
+              // both the main viewport and any row or column headers to
               // match.
 
               int xpos = 0;
@@ -526,6 +527,20 @@
               if (vp != null
                   && vp.getViewPosition() != pt)
                 vp.setViewPosition(pt);
+
+              pt.x = 0;
+
+              if (rowHeader != null 
+                  && rowHeader.getViewPosition() != pt)
+                rowHeader.setViewPosition(pt);
+              
+              pt.x = xpos;
+              pt.y = 0;
+
+              if (columnHeader != null 
+                  && columnHeader.getViewPosition() != pt)
+                columnHeader.setViewPosition(pt);
+
             }
         }
       };
Index: javax/swing/JTable.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.9
diff -u -r1.9 JTable.java
--- javax/swing/JTable.java     30 Jul 2004 20:21:19 -0000      1.9
+++ javax/swing/JTable.java     4 Sep 2004 21:12:55 -0000
@@ -39,12 +39,14 @@
 package javax.swing;
 
 import java.awt.Color;
+import java.awt.Component;
 import java.awt.Dimension;
 import java.awt.Rectangle;
 import java.util.Hashtable;
 import java.util.Vector;
 
 import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
 import javax.swing.event.CellEditorListener;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ListSelectionEvent;
@@ -53,11 +55,14 @@
 import javax.swing.event.TableColumnModelListener;
 import javax.swing.event.TableModelEvent;
 import javax.swing.event.TableModelListener;
+import javax.swing.plaf.TableUI;
 import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.DefaultTableModel;
 import javax.swing.table.JTableHeader;
 import javax.swing.table.TableCellEditor;
 import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
 import javax.swing.table.TableColumnModel;
 import javax.swing.table.TableModel;
 
@@ -67,34 +72,259 @@
 {
   private static final long serialVersionUID = 3876025080382781659L;
   
-  public static final int AUTO_RESIZE_ALL_COLUMNS = 4;
-  public static final int AUTO_RESIZE_LAST_COLUMN = 3;
-  public static final int AUTO_RESIZE_NEXT_COLUMN = 1;
+
+  /**
+   * When resizing columns, do not automatically change any columns. In this
+   * case the table should be enclosed in a address@hidden JScrollPane} in 
order to
+   * accomodate cases in which the table size exceeds its visible area.
+   */
   public static final int AUTO_RESIZE_OFF = 0;
+
+  /**
+   * When resizing column <code>i</code>, automatically change only the
+   * single column <code>i+1</code> to provide or absorb excess space
+   * requirements.
+   */
+  public static final int AUTO_RESIZE_NEXT_COLUMN = 1;
+
+  /**
+   * When resizing column <code>i</code> in a table of <code>n</code>
+   * columns, automatically change all columns in the range <code>[i+1,
+   * n)</code>, uniformly, to provide or absorb excess space requirements.
+   */
   public static final int AUTO_RESIZE_SUBSEQUENT_COLUMNS = 2;
 
-  protected boolean autoCreateColumnsFromModel;
-  protected int autoResizeMode;
-  protected TableCellEditor cellEditor;
-  protected boolean cellSelectionEnabled;
-  protected TableColumnModel columnModel;
-  protected TableModel dataModel;
+  /**
+   * When resizing column <code>i</code> in a table of <code>n</code>
+   * columns, automatically change all columns in the range <code>[0,
+   * n)</code> (with the exception of column i) uniformly, to provide or
+   * absorb excess space requirements.
+   */
+  public static final int AUTO_RESIZE_ALL_COLUMNS = 4;
+
+  /**
+   * When resizing column <code>i</code> in a table of <code>n</code>
+   * columns, automatically change column <code>n-1</code> (the last column
+   * in the table) to provide or absorb excess space requirements.
+   */
+  public static final int AUTO_RESIZE_LAST_COLUMN = 3;
+
+
+  /**
+   * A table mapping address@hidden java.lang.Class} objects to 
+   * address@hidden TableCellEditor} objects. This table is consulted by the 
+   * 
+   */
   protected Hashtable defaultEditorsByColumnClass;
   protected Hashtable defaultRenderersByColumnClass;
   protected int editingColumn;
   protected int editingRow;
-  protected Color gridColor;
-  protected Dimension preferredViewportSize;
+
+  /**
+   * Whether or not the table should automatically compute a matching
+   * address@hidden TableColumnModel} and assign it to the address@hidden 
#columnModel}
+   * property when the address@hidden #dataModel} property is changed. 
+   *
+   * @see #setModel()
+   * @see #createColumnsFromModel()
+   * @see #setColumnModel()
+   * @see #setAutoCreateColumnsFromModel()
+   * @see #getAutoCreateColumnsFromModel()
+   */
+  protected boolean autoCreateColumnsFromModel;
+
+  /**
+   * A numeric code specifying the resizing behavior of the table. Must be
+   * one of address@hidden #AUTO_RESIZE_ALL_COLUMNS} (the default), 
address@hidden
+   * #AUTO_RESIZE_LAST_COLUMN}, address@hidden #AUTO_RESIZE_NEXT_COLUMN}, 
address@hidden
+   * #AUTO_RESIZE_SUBSEQUENT_COLUMNS}, or address@hidden #AUTO_RESIZE_OFF}.
+   * 
+   * @see #doLayout()
+   * @see #setAutoResizeMode()
+   * @see #getAutoResizeMode()
+   */
+  protected int autoResizeMode;
+
+  /**
+   * The height in pixels of any row of the table. All rows in a table are
+   * of uniform height. This differs from column width, which varies on a
+   * per-column basis, and is stored in the individual columns of the
+   * address@hidden #columnModel}.
+   * 
+   * @see #getRowHeight()
+   * @see #setRowHeight()
+   * @see TableColumn#getWidth()
+   * @see TableColumn#setWidth()
+   */
   protected int rowHeight;
+
+  /**
+   * The height in pixels of the gap left between any two rows of the table. 
+   * 
+   * @see #setRowMargin()
+   * @see #getRowHeight()
+   * @see #getInterCellSpacing()
+   * @see #setInterCellSpacing()
+   * @see TableColumnModel#getColumnMargin()
+   * @see TableColumnModel#setColumnMargin()
+   */
   protected int rowMargin;
+
+  /**
+   * Whether or not the table should allow row selection. If the table
+   * allows both row <em>and</em> column selection, it is said to allow
+   * "cell selection". Previous versions of the JDK supported cell
+   * selection as an independent concept, but it is now represented solely
+   * in terms of simultaneous row and column selection.
+   *
+   * @see TableColumnModel#columnSelectionAllowed()
+   * @see #setRowSelectionAllowed()
+   * @see #getRowSelectionAllowed()
+   * @see #getCellSelectionEnabled()
+   * @see #setCellSelectionEnabled()
+   */
   protected boolean rowSelectionAllowed;
-  protected Color selectionBackground;
-  protected Color selectionForeground;
+
+  /**
+   * @deprecated Use address@hidden #rowSelectionAllowed}, address@hidden
+   * #columnSelectionAllowed}, or the combined methods address@hidden
+   * getCellSelectionEnabled} and address@hidden setCellSelectionEnabled}.
+   */
+  protected boolean cellSelectionEnabled;
+  
+  /**
+   * The model for data stored in the table. Confusingly, the published API
+   * requires that this field be called <code>dataModel</code>, despite its
+   * property name. The table listens to its model as a address@hidden
+   * TableModelListener}.
+   *
+   * @see #tableChanged()
+   * @see TableModel#addTableModelListener()
+   */
+  protected TableModel dataModel;
+
+  /**
+   * <p>A model of various aspects of the columns of the table, <em>not
+   * including</em> the data stored in them. The address@hidden 
TableColumnModel}
+   * is principally concerned with holding a set of address@hidden TableColumn}
+   * objects, each of which describes the display parameters of a column
+   * and the numeric index of the column from the data model which the
+   * column is presenting.</p>
+   *
+   * <p>The TableColumnModel also contains a address@hidden 
ListSelectionModel} which
+   * indicates which columns are currently selected. This selection model
+   * works in combination with the address@hidden selectionModel} of the table
+   * itself to specify a <em>table selection</em>: a combination of row and
+   * column selections.</p>
+   *
+   * <p>Most application programmers do not need to work with this property
+   * at all: setting address@hidden #autoCreateColumnsFromModel} will 
construct the
+   * columnModel automatically, and the table acts as a facade for most of
+   * the interesting properties of the columnModel anyways.</p>
+   * 
+   * @see #setColumnModel()
+   * @see #getColumnModel()
+   */
+  protected TableColumnModel columnModel;
+
+  /**
+   * A model of the rows of this table which are currently selected. This
+   * model is used in combination with the column selection model held as a
+   * member of the address@hidden columnModel} property, to represent the rows 
and
+   * columns (or both: cells) of the table which are currently selected.
+   *
+   * @see #rowSelectionAllowed
+   * @see #setSelectionModel()
+   * @see #getSelectionModel()
+   * @see TableColumnModel#getSelectionModel()
+   * @see ListSelectionModel#addListSelectionListener()   
+   */
   protected ListSelectionModel selectionModel;
+
+  /**
+   * The accessibleContext property.
+   */
+  protected AccessibleContext accessibleContext;
+
+  /**
+   * The current cell editor. 
+   */
+  protected TableCellEditor cellEditor;
+
+  /**
+   * Whether or not drag-and-drop is enabled on this table.
+   *
+   * @see #setDragEnabled()
+   * @see #getDragEnabled()
+   */
+  protected boolean dragEnabled;
+
+  /**
+   * The color to paint the grid lines of the table, when either address@hidden
+   * #showHorizontalLines} or address@hidden #showVerticalLines} is set.
+   *
+   * @see #setGridColor()
+   * @see #getGridColor()
+   */
+  protected Color gridColor;
+
+  /**
+   * The size this table would prefer its viewport assume, if it is
+   * contained in a address@hidden JScrollPane}.
+   *
+   * @see #setPreferredScrollableViewportSize()
+   * @see #getPreferredScrollableViewportSize()
+   */
+  protected Dimension preferredScrollableViewportSize;
+
+  /**
+   * The color to paint the background of selected cells. Fires a property
+   * change event with name address@hidden 
#SELECTION_BACKGROUND_CHANGED_PROPERTY}
+   * when its value changes.
+   *
+   * @see #setSelectionBackground()
+   * @see #getSelectionBackground()
+   */
+  Color selectionBackground;
+
+  /**
+   * The name carried in property change events when the address@hidden
+   * #selectionBackground} property changes.
+   */
+  private static final String SELECTION_BACKGROUND_CHANGED_PROPERTY = 
"selectionBackground";
+
+  /**
+   * The color to paint the foreground of selected cells. Fires a property
+   * change event with name address@hidden 
#SELECTION_FOREGROUND_CHANGED_PROPERTY}
+   * when its value changes.
+   *
+   * @see #setSelectionForeground()
+   * @see #getSelectionForeground()
+   */
+  Color selectionForeground;
+
+  /**
+   * The name carried in property change events when the
+   * address@hidden #selectionForeground} property changes.
+   */
+  private static final String SELECTION_FOREGROUND_CHANGED_PROPERTY = 
"selectionForeground";
+
+  /**
+   * The showHorizontalLines property.
+   */
   protected boolean showHorizontalLines;
+
+  /**
+   * The showVerticalLines property.
+   */
   protected boolean showVerticalLines;
+
+  /**
+   * The tableHeader property.
+   */
   protected JTableHeader tableHeader;
   
+  
   /**
    * Creates a new <code>JTable</code> instance.
    */
@@ -156,8 +386,33 @@
   public JTable (TableModel dm, TableColumnModel cm, ListSelectionModel sm)
   {
     this.dataModel = dm == null ? createDefaultDataModel() : dm;
-    this.columnModel = cm == null ? createDefaultColumnModel() : cm;
-    this.selectionModel = sm == null ? createDefaultListSelectionModel() : sm;
+    setSelectionModel(sm == null ? createDefaultListSelectionModel() : sm);
+
+    this.columnModel = cm;
+    this.autoCreateColumnsFromModel = false;
+    if (cm == null)
+      {
+        this.autoCreateColumnsFromModel = true;
+        createColumnsFromModel();
+      }
+    this.columnModel.addColumnModelListener(this);
+    
+    this.defaultRenderersByColumnClass = new Hashtable();
+    this.defaultEditorsByColumnClass = new Hashtable();
+
+    this.autoResizeMode = AUTO_RESIZE_ALL_COLUMNS;
+    this.rowHeight = 16;
+    this.rowMargin = 1;
+    this.rowSelectionAllowed = true;
+    // this.accessibleContext = new AccessibleJTable();
+    this.cellEditor = null;
+    this.dragEnabled = false;
+    this.preferredScrollableViewportSize = new Dimension(450,400);
+    this.showHorizontalLines = true;
+    this.showVerticalLines = true;
+    setInterCellSpacing(new Dimension(1,1));
+    setTableHeader(new JTableHeader(columnModel));
+    updateUI();
   }
 
   /**
@@ -179,101 +434,152 @@
     return new JScrollPane(table);
   }
 
-  public void clearSelection()
+  protected TableColumnModel createDefaultColumnModel()
   {
-    selectionModel.clearSelection();
+    return new DefaultTableColumnModel();
   }
 
-  public void columnAdded (TableColumnModelEvent event)
+  protected TableModel createDefaultDataModel()
   {
-    throw new Error ("Not implemented");
+    return new DefaultTableModel();
   }
 
-  public void columnMarginChanged (ChangeEvent event)
+  protected ListSelectionModel createDefaultListSelectionModel()
   {
-    throw new Error ("Not implemented");
+    return new DefaultListSelectionModel();
   }
   
-  public void columnMoved (TableColumnModelEvent event)
+  private void createColumnsFromModel()
+  {
+    if (dataModel == null)
+      return;
+
+    TableColumnModel cm = createDefaultColumnModel();
+
+    for (int i = 0; i < dataModel.getColumnCount(); ++i)
   {
-    throw new Error ("Not implemented");
+        cm.addColumn(new TableColumn(i));
+      }
+    this.setColumnModel(cm);
   }
   
-  public void columnRemoved (TableColumnModelEvent event)
+  // listener support 
+
+  public void columnAdded (TableColumnModelEvent event)
   {
-    throw new Error ("Not implemented");
+    revalidate();
+    repaint();
   }
   
-  public void columnSelectionChanged (ListSelectionEvent event)
+  public void columnMarginChanged (ChangeEvent event)
   {
-    throw new Error ("Not implemented");
+    revalidate();
+    repaint();
   }
  
-  protected TableColumnModel createDefaultColumnModel()
+  public void columnMoved (TableColumnModelEvent event)
   {
-    return new DefaultTableColumnModel();
+    revalidate();
+    repaint();
   }
 
-  protected TableModel createDefaultDataModel()
+  public void columnRemoved (TableColumnModelEvent event)
   {
-    return new DefaultTableModel();
+    revalidate();
+    repaint();
   }
 
-  protected ListSelectionModel createDefaultListSelectionModel()
+  public void columnSelectionChanged (ListSelectionEvent event)
   {
-    return new DefaultListSelectionModel();
+    repaint();
   }
 
   public void editingCanceled (ChangeEvent event)
   {
-    throw new Error ("Not implemented");
+    repaint();
   }
 
   public void editingStopped (ChangeEvent event)
   {
-    throw new Error ("Not implemented");
+    repaint();
   }
 
-  public TableColumnModel getColumnModel ()
+  public void tableChanged (TableModelEvent event)
   {
-    return columnModel;
+    repaint();
   }
   
-  public TableModel getModel()
+  public void valueChanged (ListSelectionEvent event)
   {
-    return dataModel;
+    repaint();
   }
   
-  public Dimension getPreferredScrollableViewportSize ()
-  {
-    throw new Error ("Not implemented");
-  }
 
-  public int getScrollableBlockIncrement (Rectangle visibleRect, int 
orientation, int direction)
+  /** 
+   * Calculate the visible rectangle for a particular row and column. The
+   * row and column are specified in visual terms; the column may not match
+   * the address@hidden #dataModel} column.
+   *
+   * @param row the visible row to get the cell rectangle of
+   *
+   * @param column the visible column to get the cell rectangle of, which may
+   * differ from the address@hidden #dataModel} column
+   *
+   * @param includeSpacing whether or not to include the cell margins in the
+   * resulting cell. If <code>false</code>, the result will only contain the
+   * inner area of the target cell, not including its margins.
+   *
+   * @return a rectangle enclosing the specified cell
+   */
+  public Rectangle getCellRect(int row,
+                               int column,
+                               boolean includeSpacing)
   {
-    throw new Error ("Not implemented");
-  }
+    int height = getHeight();
+    int width = columnModel.getColumn(column).getWidth();
+    int x_gap = columnModel.getColumnMargin();
+    int y_gap = rowMargin;
+
+    column = Math.max(0, Math.min(column, getColumnCount() - 1));
+    row = Math.max(0, Math.min(row, getRowCount() - 1));
 
-  public boolean getScrollableTracksViewportHeight ()
+    int x = 0;
+    int y = (height + y_gap) * row;
+
+    for (int i = 0; i < column; ++i)
   {
-    throw new Error ("Not implemented");
+        x += columnModel.getColumn(i).getWidth();
+        x += x_gap;
   }
   
-  public boolean getScrollableTracksViewportWidth ()
-  {
-    throw new Error ("Not implemented");
+    if (includeSpacing)
+      return new Rectangle(x, y, width, height);
+    else
+      return new Rectangle(x, y, width - x_gap, height - y_gap);
   }
 
-  public int getScrollableUnitIncrement (Rectangle visibleRect, int 
orientation, int direction)
+  public void clearSelection()
   {
-    throw new Error ("Not implemented");
+    selectionModel.clearSelection();
   }
 
+  /**
+   * Get the value of the address@hidden #selectedRow} property by delegation 
to
+   * the address@hidden ListSelectionModel#getMinSelectionIndex} method of the
+   * address@hidden #selectionModel} field.
+   *
+   * @return The current value of the selectedRow property
+   */
   public int getSelectedRow ()
   {
     return selectionModel.getMinSelectionIndex();
   }
   
+  /**
+   * Get the value of the address@hidden #selectionModel} property.
+   *
+   * @return The current value of the property
+   */
   public ListSelectionModel getSelectionModel ()
   {
     if (! rowSelectionAllowed)
@@ -282,112 +588,974 @@
     return selectionModel;
   }
 
-  public void tableChanged (TableModelEvent event)
+  public int getScrollableBlockIncrement(Rectangle visibleRect, int 
orientation, int direction)
   {
-    throw new Error ("Not implemented");
+    if (orientation == SwingConstants.VERTICAL)
+      return visibleRect.height * direction;
+    else
+      return visibleRect.width * direction;
   }
 
-  public void setModel (TableModel model)
+  /**
+   * Get the value of the address@hidden #scrollableTracksViewportHeight} 
property.
+   *
+   * @return The constant value <code>false</code>
+   */
+
+  public boolean getScrollableTracksViewportHeight()
   {
-    if (model == null)
-      throw new IllegalArgumentException();
+    return false;
+  }
 
-    // FIXME: Should we deregister from old model ?
+  /**
+   * Get the value of the address@hidden #scrollableTracksViewportWidth} 
property.
+   *
+   * @return <code>true</code> unless the address@hidden autoResizeMode} 
prperty is
+   * <code>AUTO_RESIZE_OFF</code>
+   */
     
-    dataModel = model;
-    dataModel.addTableModelListener(this);
+  public boolean getScrollableTracksViewportWidth()
+  {
+    if (autoResizeMode == AUTO_RESIZE_OFF)
+      return false;
+    else
+      return true;
   }
 
-  public void setSelectionMode (int selectionMode)
+  public int getScrollableUnitIncrement(Rectangle visibleRect, int 
orientation, int direction)
+  {
+    // FIXME: I don't exactly know what sun does here. in both cases they
+    // pick values which do *not* simply expose the next cell in a given
+    // scroll direction.
+
+    if (orientation == SwingConstants.VERTICAL)
+      return rowHeight;
+    else
   {
-    throw new Error ("Not implemented");
+        int sum = 0;
+        for (int i = 0; i < getColumnCount(); ++i)
+          sum += columnModel.getColumn(0).getWidth();
+        return getColumnCount() == 0 ? 10 : sum / getColumnCount();
+  }
   }
 
-  public void setSelectionModel (ListSelectionModel model)
+
+  public TableCellEditor getCellEditor(int row, int column)
   {
-    if (model == null)
-      throw new IllegalArgumentException();
+    TableCellEditor editor = columnModel.getColumn(column).getCellEditor();
 
-    // FIXME: Should we deregister from old model ?
+    if (editor == null)
+      editor = getDefaultEditor(dataModel.getColumnClass(column));
     
-    selectionModel = model;
-    selectionModel.addListSelectionListener(this);
+    return editor;
   }
 
-  public void setShowGrid (boolean showGrid)
+  public TableCellEditor getDefaultEditor(Class columnClass)
   {
-    throw new Error ("Not implemented");
+    if (defaultEditorsByColumnClass.containsKey(columnClass))
+      return (TableCellEditor) defaultEditorsByColumnClass.get(columnClass);
+    else
+  {
+        TableCellEditor r = new DefaultCellEditor(new JTextField());
+        defaultEditorsByColumnClass.put(columnClass, r);
+        return r;
+      }
   }
 
-  public void valueChanged (ListSelectionEvent event)
+
+
+  public TableCellRenderer getCellRenderer(int row, int column)
+  {
+    TableCellRenderer renderer =
+      columnModel.getColumn(column).getCellRenderer();
+    
+    if (renderer == null)
+      renderer = getDefaultRenderer(dataModel.getColumnClass(column));
+    
+    return renderer;
+  }
+
+  public TableCellRenderer getDefaultRenderer(Class columnClass)
   {
-    throw new Error ("Not implemented");
+    if (defaultRenderersByColumnClass.containsKey(columnClass))
+      return (TableCellRenderer) 
defaultRenderersByColumnClass.get(columnClass);
+    else
+      {
+        TableCellRenderer r = new DefaultTableCellRenderer();
+        defaultRenderersByColumnClass.put(columnClass, r);
+        return r;
+      }
+  }
+
+  public int convertColumnIndexToModel(int vc)
+  {
+    if (vc < 0)
+      return vc;
+    else if (vc > getColumnCount())
+      return -1;
+    else
+      return columnModel.getColumn(vc).getModelIndex();
   }
+  
+  public int convertColumnIndexToView(int mc)
+  {
+    if (mc < 0)
+      return mc;
+    int ncols = getColumnCount();
+    for (int vc = 0; vc < ncols; ++vc)
+  {
+        if (columnModel.getColumn(vc).getModelIndex() == mc)
+          return vc;
+      }
+    return -1;
+  }
+
+  public Component prepareRenderer(TableCellRenderer renderer,
+                                   int row,
+                                   int column)
+  {
+    boolean rsa = getRowSelectionAllowed();
+    boolean csa = getColumnSelectionAllowed();
+    boolean rs = rsa ? getSelectionModel().isSelectedIndex(row) : false;
+    boolean cs = csa ? columnModel.getSelectionModel().isSelectedIndex(column) 
: false;
+    boolean isSelected = ((rsa && csa && rs && cs) 
+                          || (rsa && !csa && rs) 
+                          || (!rsa && csa && cs));
+    
+    return renderer.getTableCellRendererComponent(this,
+                                                  dataModel.getValueAt(row, 
+                                                                       
convertColumnIndexToView(column)),
+                                                  isSelected,
+                                                  false, // hasFocus
+                                                  row, column);
+  }
+  
 
-  public JTableHeader getTableHeader()
+  /**
+   * Get the value of the address@hidden #autoCreateColumnsFromModel} property.
+   *
+   * @return The current value of the property
+   */
+  public boolean getAutoCreateColumnsFromModel()
   {
-    return tableHeader;
+    return autoCreateColumnsFromModel;
   }
 
-  public void setTableHeader(JTableHeader newHeader)
+  /**
+   * Get the value of the address@hidden #autoResizeMode} property.
+   *
+   * @return The current value of the property
+   */
+  public int getAutoResizeMode()
   {
-    tableHeader = newHeader;
+    return autoResizeMode;
   }
 
-  public boolean getColumnSelectionAllowed()
+  /**
+   * Get the value of the address@hidden #rowHeight} property.
+   *
+   * @return The current value of the property
+   */
+  public int getRowHeight()
   {
-    return columnModel.getColumnSelectionAllowed();
+    return rowHeight;
   }
-  
-  public void setColumnSelectionAllowed(boolean flag)
+
+  /**
+   * Get the value of the address@hidden #rowMargin} property.
+   *
+   * @return The current value of the property
+   */
+  public int getRowMargin()
   {
-    columnModel.setColumnSelectionAllowed(flag);
+    return rowMargin;
   }
 
+  /**
+   * Get the value of the address@hidden #rowSelectionAllowed} property.
+   *
+   * @return The current value of the property
+   */
   public boolean getRowSelectionAllowed()
   {
     return rowSelectionAllowed;
   }
-  
-  public void setRowSelectionAllowed(boolean flag)
-  {
-    rowSelectionAllowed = flag;
-  }
 
-  public int getAutoResizeMode()
+  /**
+   * Get the value of the address@hidden #cellSelectionEnabled} property.
+   *
+   * @return The current value of the property
+   */
+  public boolean getCellSelectionEnabled()
   {
-    return autoResizeMode;
+    return getColumnSelectionAllowed() && getRowSelectionAllowed();
   }
-
-  public void setAutoResizeMode(int mode)
+    
+  /**
+   * Get the value of the address@hidden #dataModel} property.
+   *
+   * @return The current value of the property
+   */
+  public TableModel getModel()
   {
-    autoResizeMode = mode;
+    return dataModel;
   }
 
+  /**
+   * Get the value of the address@hidden #columnCount} property by
+   * delegation to the @{link #dataModel} field.
+   *
+   * @return The current value of the columnCount property
+   */
   public int getColumnCount()
   {
     return dataModel.getColumnCount();
   }
 
+  /**
+   * Get the value of the address@hidden #rowCount} property by
+   * delegation to the @{link #dataModel} field.
+   *
+   * @return The current value of the rowCount property
+   */
   public int getRowCount()
   {
     return dataModel.getRowCount();
   }
 
-  public TableCellRenderer getCellRenderer(int row, int column)
+  /**
+   * Get the value of the address@hidden #columnModel} property.
+   *
+   * @return The current value of the property
+   */
+  public TableColumnModel getColumnModel()
   {
-    TableCellRenderer renderer =
-      columnModel.getColumn(column).getCellRenderer();
-    
-    if (renderer == null)
-      renderer = getDefaultRenderer(dataModel.getColumnClass(column));
-    
-    return renderer;
+    return columnModel;
   }
 
-  public TableCellRenderer getDefaultRenderer(Class columnClass)
+  /**
+   * Get the value of the address@hidden #selectedColumn} property by
+   * delegation to the @{link #columnModel} field.
+   *
+   * @return The current value of the selectedColumn property
+   */
+  public int getSelectedColumn()
+  {
+    return columnModel.getSelectionModel().getMinSelectionIndex();
+  }
+
+  private static int countSelections(ListSelectionModel lsm)
+  {
+    int lo = lsm.getMinSelectionIndex();
+    int hi = lsm.getMaxSelectionIndex();
+    int sum = 0;
+    if (lo != -1 && hi != -1)
+      {
+        switch (lsm.getSelectionMode())
+          {
+          case ListSelectionModel.SINGLE_SELECTION:
+            sum = 1;
+            break;
+            
+          case ListSelectionModel.SINGLE_INTERVAL_SELECTION:
+            sum = hi - lo;
+            break;
+            
+          case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION:        
+            for (int i = lo; i < hi; ++i)
+              if (lsm.isSelectedIndex(i))        
+                ++sum;
+            break;
+          }
+      }
+    return sum;
+  }
+
+  private static int[] getSelections(ListSelectionModel lsm)
+  {
+    int sz = countSelections(lsm);
+    int [] ret = new int[sz];
+
+    int lo = lsm.getMinSelectionIndex();
+    int hi = lsm.getMaxSelectionIndex();
+    int j = 0;
+    java.util.ArrayList ls = new java.util.ArrayList();
+    if (lo != -1 && hi != -1)
+      {
+        switch (lsm.getSelectionMode())
+          {
+          case ListSelectionModel.SINGLE_SELECTION:
+            ret[0] = lo;
+            break;      
+      
+          case ListSelectionModel.SINGLE_INTERVAL_SELECTION:            
+            for (int i = lo; i < hi; ++i)
+              ret[j++] = i;
+            break;
+            
+          case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION:        
+            for (int i = lo; i < hi; ++i)
+              if (lsm.isSelectedIndex(i))        
+                ret[j++] = i;
+            break;
+          }
+      }
+    return ret;
+  }
+
+  /**
+   * Get the value of the address@hidden #selectedColumnCount} property by
+   * delegation to the @{link #columnModel} field.
+   *
+   * @return The current value of the selectedColumnCount property
+   */  
+  public int getSelectedColumnCount()
+  {
+    return countSelections(columnModel.getSelectionModel());
+  }
+
+  /**
+   * Get the value of the address@hidden #selectedColumns} property by
+   * delegation to the @{link #columnModel} field.
+   *
+   * @return The current value of the selectedColumns property
+   */
+  public int[] getSelectedColumns()
+  {
+    return getSelections(columnModel.getSelectionModel());
+  }
+
+  /**
+   * Get the value of the address@hidden #columnSelectionAllowed} property.
+   *
+   * @return The current value of the columnSelectionAllowed property
+   */
+  public boolean getColumnSelectionAllowed()
+  {
+    return getColumnModel().getColumnSelectionAllowed();
+  }
+
+  /**
+   * Get the value of the address@hidden #selectedRowCount} property by
+   * delegation to the @{link #selectionModel} field.
+   *
+   * @return The current value of the selectedRowCount property
+   */
+  public int getSelectedRowCount()
+  {
+    return countSelections(selectionModel);
+  }
+
+  /**
+   * Get the value of the address@hidden #selectedRows} property by
+   * delegation to the @{link #selectionModel} field.
+   *
+   * @return The current value of the selectedRows property
+   */
+  public int[] getSelectedRows()
+  {
+    return getSelections(selectionModel);
+  }
+
+  /**
+   * Get the value of the address@hidden #accessibleContext} property.
+   *
+   * @return The current value of the property
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    return accessibleContext;
+  }
+
+  /**
+   * Get the value of the address@hidden #cellEditor} property.
+   *
+   * @return The current value of the property
+   */
+  public TableCellEditor getCellEditor()
+  {
+    return cellEditor;
+  }
+
+  /**
+   * Get the value of the address@hidden #dragEnabled} property.
+   *
+   * @return The current value of the property
+   */
+  public boolean getDragEnabled()
+  {
+    return dragEnabled;
+  }
+
+  /**
+   * Get the value of the address@hidden #gridColor} property.
+   *
+   * @return The current value of the property
+   */
+  public Color getGridColor()
+  {
+    return gridColor;
+  }
+
+  /**
+   * Get the value of the address@hidden #interCellSpacing} property.
+   *
+   * @return The current value of the property
+   */
+  public Dimension getInterCellSpacing()
+  {
+    return new Dimension(columnModel.getColumnMargin(), rowMargin);
+  }
+
+  /**
+   * Get the value of the address@hidden #preferredScrollableViewportSize} 
property.
+   *
+   * @return The current value of the property
+   */
+  public Dimension getPreferredScrollableViewportSize()
+  {
+    return preferredScrollableViewportSize;
+  }
+
+  /**
+   * Get the value of the address@hidden #selectionBackground} property.
+   *
+   * @return The current value of the property
+   */
+  public Color getSelectionBackground()
+  {
+    return selectionBackground;
+  }
+
+  /**
+   * Get the value of the address@hidden #selectionForeground} property.
+   *
+   * @return The current value of the property
+   */
+  public Color getSelectionForeground()
+  {
+    return selectionForeground;
+  }
+
+  /**
+   * Get the value of the address@hidden #showHorizontalLines} property.
+   *
+   * @return The current value of the property
+   */
+  public boolean getShowHorizontalLines()
+  {
+    return showHorizontalLines;
+  }
+
+  /**
+   * Get the value of the address@hidden #showVerticalLines} property.
+   *
+   * @return The current value of the property
+   */
+  public boolean getShowVerticalLines()
+  {
+    return showVerticalLines;
+  }
+
+  /**
+   * Get the value of the address@hidden #tableHeader} property.
+   *
+   * @return The current value of the property
+   */
+  public JTableHeader getTableHeader()
+  {
+    return tableHeader;
+  }
+
+  /**
+   * Set the value of the address@hidden #autoCreateColumnsFromModel} property.
+   *
+   * @param a The new value of the autoCreateColumnsFromModel property
+   */ 
+  public void setAutoCreateColumnsFromModel(boolean a)
+  {
+    autoCreateColumnsFromModel = a;
+  }
+
+  /**
+   * Set the value of the address@hidden #autoResizeMode} property.
+   *
+   * @param a The new value of the autoResizeMode property
+   */ 
+  public void setAutoResizeMode(int a)
+  {
+    autoResizeMode = a;
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Set the value of the address@hidden #rowHeight} property.
+   *
+   * @param r The new value of the rowHeight property
+   */ 
+  public void setRowHeight(int r)
+  {
+    rowHeight = r;
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Set the value of the address@hidden #rowMargin} property.
+   *
+   * @param r The new value of the rowMargin property
+   */ 
+  public void setRowMargin(int r)
+  {
+    rowMargin = r;
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Set the value of the address@hidden #rowSelectionAllowed} property.
+   *
+   * @param r The new value of the rowSelectionAllowed property
+   */ 
+  public void setRowSelectionAllowed(boolean r)
+  {
+    rowSelectionAllowed = r;
+    repaint();
+  }
+
+  /**
+   * Set the value of the address@hidden #cellSelectionEnabled} property.
+   *
+   * @param c The new value of the cellSelectionEnabled property
+   */ 
+  public void setCellSelectionEnabled(boolean c)
+  {
+    setColumnSelectionAllowed(c);
+    setRowSelectionAllowed(c);
+    // for backward-compatibility sake:
+    cellSelectionEnabled = true;
+  }
+
+  /**
+   * <p>Set the value of the address@hidden #dataModel} property.</p>
+   *
+   * <p>Unregister <code>this</code> as a address@hidden TableModelListener} 
from
+   * previous address@hidden #dataModel} and register it with new parameter
+   * <code>m</code>.</p>
+   *
+   * @param m The new value of the model property
+   */ 
+  public void setModel(TableModel m)
+  {
+    if (m == null)
+      throw new IllegalArgumentException();
+    TableModel tmp = dataModel;
+    if (autoCreateColumnsFromModel)
+      createColumnsFromModel();
+    if (tmp != null)
+      tmp.removeTableModelListener(this);
+    if (m != null)
+      m.addTableModelListener(this);
+    dataModel = m;
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * <p>Set the value of the address@hidden #columnModel} property.</p>
+   *
+   * <p>Unregister <code>this</code> as a address@hidden 
TableColumnModelListener}
+   * from previous address@hidden #columnModel} and register it with new 
parameter
+   * <code>c</code>.</p>
+   *
+   * @param c The new value of the columnModel property
+   */ 
+  public void setColumnModel(TableColumnModel c)
+  {
+    if (c == null)
+      throw new IllegalArgumentException();
+    TableColumnModel tmp = columnModel;
+    if (tmp != null)
+      tmp.removeColumnModelListener(this);
+    if (c != null)
+      c.addColumnModelListener(this);
+    columnModel = c;
+    if (dataModel != null && columnModel != null)
+      {
+        int ncols = getColumnCount();
+        for (int i = 0; i < ncols; ++i)
+          columnModel.getColumn(i).setHeaderValue(dataModel.getColumnName(i));
+      }
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Set the value of the address@hidden #columnSelectionAllowed} property.
+   *
+   * @param c The new value of the property
+   */ 
+  public void setColumnSelectionAllowed(boolean c)
+  {
+    getColumnModel().setColumnSelectionAllowed(c);
+    repaint();
+  }
+
+  /**
+   * <p>Set the value of the address@hidden #selectionModel} property.</p>
+   *
+   * <p>Unregister <code>this</code> as a address@hidden ListSelectionListener}
+   * from previous address@hidden #selectionModel} and register it with new
+   * parameter <code>s</code>.</p>
+   *
+   * @param s The new value of the selectionModel property
+   */ 
+  public void setSelectionModel(ListSelectionModel s)
+  {
+    if (s == null)
+      throw new IllegalArgumentException();
+    ListSelectionModel tmp = selectionModel;
+    if (tmp != null)
+      tmp.removeListSelectionListener(this);
+    if (s != null)
+      s.addListSelectionListener(this);
+    selectionModel = s;
+  }
+
+  /**
+   * Set the value of the address@hidden #selectionMode} property by
+   * delegation to the address@hidden #selectionModel} field.
+   *
+   * @param s The new value of the property
+   */ 
+  public void setSelectionMode(int s)
+  {
+    selectionModel.setSelectionMode(s);
+    repaint();
+  }
+
+  /**
+   * <p>Set the value of the address@hidden #cellEditor} property.</p>
+   *
+   * <p>Unregister <code>this</code> as a address@hidden CellEditorListener} 
from
+   * previous address@hidden #cellEditor} and register it with new parameter
+   * <code>c</code>.</p>
+   *
+   * @param c The new value of the cellEditor property
+   */ 
+  public void setCellEditor(TableCellEditor c)
+  {
+    TableCellEditor tmp = cellEditor;
+    if (tmp != null)
+      tmp.removeCellEditorListener(this);
+    if (c != null)
+      c.addCellEditorListener(this);
+    cellEditor = c;
+  }
+
+  /**
+   * Set the value of the address@hidden #dragEnabled} property.
+   *
+   * @param d The new value of the dragEnabled property
+   */ 
+  public void setDragEnabled(boolean d)
+  {
+    dragEnabled = d;
+  }
+
+  /**
+   * Set the value of the address@hidden #gridColor} property.
+   *
+   * @param g The new value of the gridColor property
+   */ 
+  public void setGridColor(Color g)
+  {
+    gridColor = g;
+    repaint();
+  }
+
+  /**
+   * Set the value of the address@hidden #interCellSpacing} property.
+   *
+   * @param i The new value of the interCellSpacing property
+   */ 
+  public void setInterCellSpacing(Dimension i)
+  {
+    rowMargin = i.height;
+    columnModel.setColumnMargin(i.width);
+    repaint();
+  }
+
+  /**
+   * Set the value of the address@hidden #preferredScrollableViewportSize} 
property.
+   *
+   * @param p The new value of the preferredScrollableViewportSize property
+   */ 
+  public void setPreferredScrollableViewportSize(Dimension p)
+  {
+    preferredScrollableViewportSize = p;
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * <p>Set the value of the address@hidden #selectionBackground} property.</p>
+   *
+   * <p>Fire a PropertyChangeEvent with name address@hidden
+   * #SELECTION_BACKGROUND_CHANGED_PROPERTY} to registered listeners, if
+   * selectionBackground changed.</p>
+   *
+   * @param s The new value of the selectionBackground property
+   */ 
+  public void setSelectionBackground(Color s)
+  {
+    Color tmp = selectionBackground;
+    selectionBackground = s;
+    if (((tmp == null && s != null)
+         || (s == null && tmp != null)
+         || (tmp != null && s != null && !tmp.equals(s))))
+      firePropertyChange(SELECTION_BACKGROUND_CHANGED_PROPERTY, tmp, s);
+    repaint();
+  }
+
+  /**
+   * <p>Set the value of the address@hidden #selectionForeground} property.</p>
+   *
+   * <p>Fire a PropertyChangeEvent with name address@hidden
+   * SELECTION_FOREGROUND_CHANGED_PROPERTY} to registered listeners, if
+   * selectionForeground changed.</p>
+   *
+   * @param s The new value of the selectionForeground property
+   */ 
+  public void setSelectionForeground(Color s)
+  {
+    Color tmp = selectionForeground;
+    selectionForeground = s;
+    if (((tmp == null && s != null)
+         || (s == null && tmp != null)
+         || (tmp != null && s != null && !tmp.equals(s))))
+      firePropertyChange(SELECTION_FOREGROUND_CHANGED_PROPERTY, tmp, s);
+    repaint();
+  }
+
+  /**
+   * Set the value of the address@hidden #showGrid} property.
+   *
+   * @param s The new value of the showGrid property
+   */ 
+  public void setShowGrid(boolean s)
   {
-    // FIXME:
-    return null;
+    setShowVerticalLines(s);
+    setShowHorizontalLines(s);
   }
+
+  /**
+   * Set the value of the address@hidden #showHorizontalLines} property.
+   *
+   * @param s The new value of the showHorizontalLines property
+   */ 
+  public void setShowHorizontalLines(boolean s)
+  {
+    showHorizontalLines = s;
+    repaint();
+  }
+
+  /**
+   * Set the value of the address@hidden #showVerticalLines} property.
+   *
+   * @param s The new value of the showVerticalLines property
+   */ 
+  public void setShowVerticalLines(boolean s)
+  {
+    showVerticalLines = s;
+    repaint();
+  }
+
+  /**
+   * Set the value of the address@hidden #tableHeader} property.
+   *
+   * @param t The new value of the tableHeader property
+   */ 
+  public void setTableHeader(JTableHeader t)
+  {
+    if (tableHeader != null)
+      tableHeader.setTable(null);
+    tableHeader = t;
+    if (tableHeader != null)
+      tableHeader.setTable(this);
+    revalidate();
+    repaint();
+  }
+
+  protected void configureEnclosingScrollPane()
+  {
+    JScrollPane jsp = (JScrollPane) 
SwingUtilities.getAncestorOfClass(JScrollPane.class, this);
+    if (jsp != null && tableHeader != null)
+      {
+        jsp.setColumnHeaderView(tableHeader);
+      }
+  }
+
+  protected void unconfigureEnclosingScrollPane()
+  {
+    JScrollPane jsp = (JScrollPane) 
SwingUtilities.getAncestorOfClass(JScrollPane.class, this);
+    if (jsp != null)
+      {
+        jsp.setColumnHeaderView(null);
+      }    
+  }
+
+
+  public void addNotify()
+  {
+    super.addNotify();
+    configureEnclosingScrollPane();
+  }
+
+  public void removeNotify()
+  {
+    super.addNotify();
+    unconfigureEnclosingScrollPane();
+  }
+
+
+  /**
+   * Sun javadocs describe an unusual implementation of
+   * <code>doLayout</code> which involves some private interfaces. We try
+   * to implement the same algorithm as is documented, but using the
+   * columnModel directly. We still use a private helper method, but it has
+   * a simpler signature.
+   */
+
+  private void distributeSpill(TableColumn[] cols, int spill)
+  {
+    int MIN = 0;
+    int MAX = 0;
+    int PREF = 0;
+
+    int[] min = new int[cols.length];
+    int[] max = new int[cols.length];
+    int[] pref = new int[cols.length];
+
+    for (int i = 0; i < cols.length; ++i)
+      {
+        pref[i] = cols[i].getPreferredWidth();
+        min[i] = cols[i].getMinWidth();
+        max[i] = cols[i].getMaxWidth();
+        PREF += pref[i];
+        MIN += min[i];
+        MAX += max[i];
+      }
+
+    for (int i = 0; i < cols.length; ++i)
+      {
+        int adj = 0;
+        if (spill > 0)          
+          adj = (spill * (pref[i] - min[i])) / (PREF - MIN);
+        else
+          adj = (spill * (max[i] - pref[i])) / (MAX - PREF);
+        cols[i].setWidth(pref[i] + adj);        
+      }    
+  }
+  
+  public void doLayout()
+  {
+    TableColumn resizingColumn = null;
+
+    int ncols = getColumnCount();
+    if (ncols < 1)
+      return;
+
+    int[] pref = new int[ncols];
+    int prefSum = 0;
+    int rCol = -1;
+
+    if (tableHeader != null)
+      resizingColumn = tableHeader.getResizingColumn();
+
+    for (int i = 0; i < ncols; ++i)
+      {
+        TableColumn col = columnModel.getColumn(i);
+        int p = col.getWidth();
+        pref[i] = p;
+        prefSum += p;
+        if (resizingColumn == col)
+          rCol = i;
+      }
+
+    int spill = prefSum - getWidth();
+
+    if (resizingColumn != null)
+      {
+        TableColumn col;
+        TableColumn [] cols;
+
+        switch (getAutoResizeMode())
+          {
+          case AUTO_RESIZE_LAST_COLUMN:
+            col = columnModel.getColumn(ncols-1);
+            col.setWidth(col.getPreferredWidth() + spill);
+            break;
+            
+          case AUTO_RESIZE_NEXT_COLUMN:
+            col = columnModel.getColumn(ncols-1);
+            col.setWidth(col.getPreferredWidth() + spill);
+            break;
+
+          case AUTO_RESIZE_ALL_COLUMNS:
+            cols = new TableColumn[ncols];
+            for (int i = 0; i < ncols; ++i)
+              cols[i] = columnModel.getColumn(i);
+            distributeSpill(cols, spill);
+            break;
+
+          case AUTO_RESIZE_SUBSEQUENT_COLUMNS:
+            cols = new TableColumn[ncols];
+            for (int i = rCol; i < ncols; ++i)
+              cols[i] = columnModel.getColumn(i);
+            distributeSpill(cols, spill);
+            break;
+
+          case AUTO_RESIZE_OFF:
+          default:
+          }
+      }
+    else
+      {
+        TableColumn [] cols = new TableColumn[ncols];
+        for (int i = 0; i < ncols; ++i)
+          cols[i] = columnModel.getColumn(i);
+        distributeSpill(cols, spill);        
+      }
+  }
+  
+  public void sizeColumnsToFit(boolean lastColumnOnly)
+  {
+    doLayout();
+  }
+
+  public void sizeColumnsToFit(int resizingColumn)
+  {
+    doLayout();
+  }
+
+
+  public String getUIClassID()
+  {
+    return "TableUI";
+  }
+
+  public TableUI getUI()
+  {
+    return (TableUI) ui;
+  }
+
+  public void updateUI()
+  {
+    setUI((TableUI) UIManager.getUI(this));
+    revalidate();
+    repaint();
+  }
+
 }
Index: javax/swing/JViewport.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JViewport.java,v
retrieving revision 1.10
diff -u -r1.10 JViewport.java
--- javax/swing/JViewport.java  22 Jul 2004 19:45:39 -0000      1.10
+++ javax/swing/JViewport.java  4 Sep 2004 21:12:55 -0000
@@ -249,9 +249,14 @@
 
   public void setView(Component v)
   {
+    while (getComponentCount() > 0)
+      remove(0);
+    if (v != null)
+      {
     add(v);
     fireStateChanged();
   }
+  }
 
   public void revalidate()
   {
Index: javax/swing/ScrollPaneLayout.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/ScrollPaneLayout.java,v
retrieving revision 1.8
diff -u -r1.8 ScrollPaneLayout.java
--- javax/swing/ScrollPaneLayout.java   30 Jul 2004 20:21:19 -0000      1.8
+++ javax/swing/ScrollPaneLayout.java   4 Sep 2004 21:12:55 -0000
@@ -82,6 +82,8 @@
 
   public void syncWithScrollPane(JScrollPane scrollPane) {
     viewport = scrollPane.getViewport();
+    rowHead = scrollPane.getRowHeader();
+    colHead = scrollPane.getColumnHeader();
     vsb = scrollPane.getVerticalScrollBar();
     hsb = scrollPane.getHorizontalScrollBar();
     vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
@@ -389,12 +391,12 @@
             y4 = scrollPaneBounds.y + scrollPaneBounds.height;
             
             if (colHead != null)
-              y2 = colHead.getPreferredSize().height;
+              y2 = y1 + colHead.getPreferredSize().height;
             else
               y2 = y1;
 
             if (rowHead != null)
-              x2 = rowHead.getPreferredSize().width;
+              x2 = x1 + rowHead.getPreferredSize().width;
             else
               x2 = x1;
 
Index: javax/swing/Timer.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/Timer.java,v
retrieving revision 1.11
diff -u -r1.11 Timer.java
--- javax/swing/Timer.java      4 Sep 2004 20:31:20 -0000       1.11
+++ javax/swing/Timer.java      4 Sep 2004 21:12:55 -0000
@@ -394,7 +394,8 @@
   public void stop()
   {
     running = false;
-    waker.interrupt();
+    if (waker != null)
+      waker.interrupt();
     synchronized (queueLock)
       {
        queue = 0;
Index: javax/swing/plaf/basic/BasicTableHeaderUI.java
===================================================================
RCS file: javax/swing/plaf/basic/BasicTableHeaderUI.java
diff -N javax/swing/plaf/basic/BasicTableHeaderUI.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ javax/swing/plaf/basic/BasicTableHeaderUI.java      4 Sep 2004 21:12:55 
-0000
@@ -0,0 +1,264 @@
+package javax.swing.plaf.basic;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import javax.swing.CellRendererPane;
+import javax.swing.JComponent;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.border.Border;
+import javax.swing.event.MouseInputListener;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.TableHeaderUI;
+import javax.swing.table.JTableHeader;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+
+
+public class BasicTableHeaderUI
+  extends TableHeaderUI
+{
+
+  public static ComponentUI createUI(JComponent h)
+  {
+    return new BasicTableHeaderUI();
+  }
+
+  protected JTableHeader header;
+  protected MouseInputListener mouseInputListener;
+  protected CellRendererPane rendererPane;
+  protected Border cellBorder;
+
+  class MouseInputHandler
+    implements MouseInputListener
+  {
+    public void mouseClicked(MouseEvent e) {}
+    public void mouseDragged(MouseEvent e) {}
+    public void mouseEntered(MouseEvent e) {}
+    public void mouseExited(MouseEvent e) {}
+    public void mouseMoved(MouseEvent e) {}
+    public void mousePressed(MouseEvent e) {}
+    public void mouseReleased(MouseEvent e) {}
+  }
+
+  protected MouseInputListener createMouseInputListener()
+  {
+    return new MouseInputHandler();
+  }
+
+  public BasicTableHeaderUI()
+  {
+    mouseInputListener = createMouseInputListener();
+  }
+
+  protected void installDefaults()
+  {
+    UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+    header.setBackground(defaults.getColor("TableHeader.background"));
+    header.setForeground(defaults.getColor("TableHeader.foreground"));
+    header.setFont(defaults.getFont("TableHeader.font"));
+    cellBorder = defaults.getBorder("TableHeader.cellBorder");
+  }
+
+  protected void installKeyboardActions()
+  {
+  }
+
+  protected void installListeners()
+  {
+    header.addMouseListener(mouseInputListener);
+  }
+
+  public void installUI(JComponent c)
+  {
+    header = (JTableHeader) c;
+    installDefaults();
+    installKeyboardActions();
+    installListeners();
+  }
+
+  protected void uninstallDefaults()
+  {
+    header.setBackground(null);
+    header.setForeground(null);
+    header.setFont(null);
+  }
+
+  protected void uninstallKeyboardActions()
+  {
+  }
+
+  protected void uninstallListeners()
+  {
+    header.removeMouseListener(mouseInputListener);
+  }
+
+  public void uninstallUI(JComponent c)
+  {
+    uninstallListeners();
+    uninstallKeyboardActions();
+    uninstallDefaults();
+  }
+
+  public void paint(Graphics gfx, JComponent c)
+  {
+    TableColumnModel cmod = header.getColumnModel();
+    int ncols = cmod.getColumnCount();
+    if (ncols == 0)
+      return;
+    
+    Rectangle clip = gfx.getClipBounds();
+    TableCellRenderer defaultRend = header.getDefaultRenderer();
+
+    for (int i = 0; i < ncols; ++i)
+      {
+        Rectangle bounds = header.getHeaderRect(i);
+        if (bounds.intersects(clip))
+          {
+            TableColumn col = cmod.getColumn(i);
+            TableCellRenderer rend = col.getHeaderRenderer();
+            if (rend == null)
+              rend = defaultRend;
+            Object val = col.getHeaderValue();
+            Component comp = 
rend.getTableCellRendererComponent(header.getTable(),
+                                                                val,
+                                                                false, // 
isSelected
+                                                                false, // 
isFocused
+                                                                -1, i);
+            comp.setFont(header.getFont());
+            comp.setBackground(header.getBackground());
+            comp.setForeground(header.getForeground());
+            if (comp instanceof JComponent)
+              ((JComponent)comp).setBorder(cellBorder);
+            gfx.translate(bounds.x, bounds.y);
+            comp.setSize(bounds.width, bounds.height);
+            comp.setLocation(0,0);
+            comp.paint(gfx);
+            gfx.translate(-bounds.x, -bounds.y);
+          }
+      }
+
+  }
+
+  public Dimension getMaximumSize(JComponent c)
+  {
+    TableColumnModel cmod = header.getColumnModel();
+    TableCellRenderer defaultRend = header.getDefaultRenderer();
+    int ncols = cmod.getColumnCount();    
+    int spacing = 0;
+    Dimension ret = getPreferredSize(c);
+    
+    if (header.getTable() != null 
+        && header.getTable().getInterCellSpacing() != null)
+      spacing = header.getTable().getInterCellSpacing().width;
+
+    ret.width = 0;
+    for (int i = 0; i < ncols; ++i)      
+      {
+        TableColumn col = cmod.getColumn(i);
+        TableCellRenderer rend = col.getHeaderRenderer();
+        if (rend == null)
+          rend = defaultRend;
+        Object val = col.getHeaderValue();
+        Component comp = rend.getTableCellRendererComponent(header.getTable(),
+                                                            val,
+                                                            false, // 
isSelected
+                                                            false, // isFocused
+                                                            -1, i);
+        comp.setFont(header.getFont());
+        comp.setBackground(header.getBackground());
+        comp.setForeground(header.getForeground());
+        if (comp instanceof JComponent)
+          ((JComponent)comp).setBorder(cellBorder);
+
+        Dimension d = comp.getMaximumSize();
+        ret.width += col.getMaxWidth();
+        ret.height = Math.max(ret.height, d.height);
+        ret.width += spacing;
+      }
+    return ret;
+  }
+
+  public Dimension getMinimumSize(JComponent c)
+  {
+    TableColumnModel cmod = header.getColumnModel();
+    TableCellRenderer defaultRend = header.getDefaultRenderer();
+    int ncols = cmod.getColumnCount();    
+    int spacing = 0;
+    Dimension ret = getPreferredSize(c);
+
+    if (header.getTable() != null 
+        && header.getTable().getInterCellSpacing() != null)
+      spacing = header.getTable().getInterCellSpacing().width;
+
+    ret.width = 0;
+    for (int i = 0; i < ncols; ++i)      
+      {
+        TableColumn col = cmod.getColumn(i);
+        TableCellRenderer rend = col.getHeaderRenderer();
+        if (rend == null)
+          rend = defaultRend;
+        Object val = col.getHeaderValue();
+        Component comp = rend.getTableCellRendererComponent(header.getTable(),
+                                                            val,
+                                                            false, // 
isSelected
+                                                            false, // isFocused
+                                                            -1, i);
+        comp.setFont(header.getFont());
+        comp.setBackground(header.getBackground());
+        comp.setForeground(header.getForeground());
+        if (comp instanceof JComponent)
+          ((JComponent)comp).setBorder(cellBorder);
+
+        Dimension d = comp.getMinimumSize();
+        ret.width += col.getMinWidth();
+        ret.width += spacing;
+        ret.height = Math.max(ret.height, d.height);
+      }
+    return ret;
+  }
+  
+  public Dimension getPreferredSize(JComponent c)
+  {
+    TableColumnModel cmod = header.getColumnModel();
+    TableCellRenderer defaultRend = header.getDefaultRenderer();
+    int ncols = cmod.getColumnCount();    
+    Dimension ret = new Dimension(0,0);
+    int spacing = 0;
+
+    if (header.getTable() != null 
+        && header.getTable().getInterCellSpacing() != null)
+      spacing = header.getTable().getInterCellSpacing().width;
+    
+    for (int i = 0; i < ncols; ++i)      
+      {
+        TableColumn col = cmod.getColumn(i);
+        TableCellRenderer rend = col.getHeaderRenderer();
+        if (rend == null)
+          rend = defaultRend;
+        Object val = col.getHeaderValue();
+        Component comp = rend.getTableCellRendererComponent(header.getTable(),
+                                                            val,
+                                                            false, // 
isSelected
+                                                            false, // isFocused
+                                                            -1, i);
+        comp.setFont(header.getFont());
+        comp.setBackground(header.getBackground());
+        comp.setForeground(header.getForeground());
+        if (comp instanceof JComponent)
+          ((JComponent)comp).setBorder(cellBorder);
+
+        Dimension d = comp.getPreferredSize();
+        ret.width += d.width;
+        ret.width += spacing;
+        ret.height = Math.max(d.height, ret.height);        
+      }
+    return ret;
+  }
+  
+  
+}
Index: javax/swing/plaf/basic/BasicTableUI.java
===================================================================
RCS file: javax/swing/plaf/basic/BasicTableUI.java
diff -N javax/swing/plaf/basic/BasicTableUI.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ javax/swing/plaf/basic/BasicTableUI.java    4 Sep 2004 21:12:55 -0000
@@ -0,0 +1,337 @@
+package javax.swing.plaf.basic;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.MouseEvent;
+import javax.swing.CellRendererPane;
+import javax.swing.JComponent;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.MouseInputListener;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.TableUI;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
+
+public class BasicTableUI
+  extends TableUI
+{
+
+  public static ComponentUI createUI(JComponent comp) 
+  {
+    return new BasicTableUI();
+  }
+
+  protected FocusListener focusListener;  
+  protected KeyListener keyListener;   
+  protected MouseInputListener mouseInputListener;   
+  protected CellRendererPane rendererPane;   
+  protected JTable table;
+
+  class FocusHandler implements FocusListener
+  {
+    public void focusGained(FocusEvent e) 
+    {
+    }
+    public void focusLost(FocusEvent e) 
+    {
+    }
+  }
+
+  class KeyHandler implements KeyListener
+  {
+    public void keyPressed(KeyEvent e) 
+    {
+    }
+    public void keyReleased(KeyEvent e) 
+    {
+    }
+    public void keyTyped(KeyEvent e) 
+    {
+    }
+  }
+
+  class MouseInputHandler implements MouseInputListener
+  {
+    Point begin, curr;
+
+    private int getRowForPoint(Point p)
+    {      
+      int y0 = table.getLocation().y;
+      int nrows = table.getRowCount();
+      Dimension gap = table.getInterCellSpacing();
+      int height = table.getRowHeight() + (gap == null ? 0 : gap.height);
+      int y = p.y;
+      for (int i = 0; i < nrows; ++i)
+        {
+          if (0 <= y && y < height)
+            return i;
+          y -= height;
+        }
+      return -1;
+    }
+
+    private int getColForPoint(Point p)
+    {
+      int x0 = table.getLocation().x;
+      int ncols = table.getColumnCount();
+      Dimension gap = table.getInterCellSpacing();
+      TableColumnModel cols = table.getColumnModel();      
+      int x = p.x;
+      for (int i = 0; i < ncols; ++i)
+        {
+          int width = cols.getColumn(i).getWidth() + (gap == null ? 0 : 
gap.width);
+          if (0 <= x && x < width)
+            return i;
+          x -= width;
+        }
+      return -1;
+    }
+
+    private void updateSelection()
+    {
+      if (table.getRowSelectionAllowed())
+        {
+          int lo_row = getRowForPoint(begin);
+          int hi_row  = getRowForPoint(curr);
+          ListSelectionModel rowModel = table.getSelectionModel();
+          if (lo_row != -1 && hi_row != -1)
+            rowModel.setSelectionInterval(lo_row, hi_row);
+        }
+
+      if (table.getColumnSelectionAllowed())
+        {
+          int lo_col = getColForPoint(begin);
+          int hi_col = getColForPoint(curr);
+          ListSelectionModel colModel = 
table.getColumnModel().getSelectionModel();
+          if (lo_col != -1 && hi_col != -1)
+            colModel.setSelectionInterval(lo_col, hi_col);
+        }
+    }
+
+    public void mouseClicked(MouseEvent e) 
+    {
+    }
+    public void mouseDragged(MouseEvent e) 
+    {
+      curr = new Point(e.getX(), e.getY());
+      updateSelection();      
+    }
+    public void mouseEntered(MouseEvent e) 
+    {
+    }
+    public void mouseExited(MouseEvent e) 
+    {
+    }
+    public void mouseMoved(MouseEvent e) 
+    {
+    }
+    public void mousePressed(MouseEvent e) 
+    {
+      begin = new Point(e.getX(), e.getY());
+      curr = new Point(e.getX(), e.getY());
+      updateSelection();
+    }
+    public void mouseReleased(MouseEvent e) 
+    {
+      begin = null;
+      curr = null;
+    }
+  }
+
+  protected FocusListener createFocusListener() 
+  {
+    return new FocusHandler();
+  }
+  protected KeyListener createKeyListener() 
+  {
+    return new KeyHandler();
+  }
+  protected MouseInputListener createMouseInputListener() 
+  {
+    return new MouseInputHandler();
+  }
+
+  public Dimension getMaximumSize(JComponent comp) 
+  {
+    return getPreferredSize(comp);
+  }
+
+  public Dimension getMinimumSize(JComponent comp) 
+  {
+    return getPreferredSize(comp);
+  }
+
+  public Dimension getPreferredSize(JComponent comp) 
+  {
+    int width = table.getColumnModel().getTotalColumnWidth();
+    int height = table.getRowCount() * table.getRowHeight();
+    return new Dimension(width, height);
+  }
+
+  protected void installDefaults() 
+  {
+    UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+    table.setFont(defaults.getFont("Table.font"));
+    table.setGridColor(defaults.getColor("Table.gridColor"));
+    table.setForeground(defaults.getColor("Table.foreground"));
+    table.setBackground(defaults.getColor("Table.background"));
+    
table.setSelectionForeground(defaults.getColor("Table.selectionForeground"));
+    
table.setSelectionBackground(defaults.getColor("Table.selectionBackground"));
+    table.setOpaque(true);
+  }
+  protected void installKeyboardActions() 
+  {
+  }
+
+  protected void installListeners() 
+  {
+    table.addFocusListener(focusListener);  
+    table.addKeyListener(keyListener);
+    table.addMouseListener(mouseInputListener);    
+  }
+
+  protected void uninstallDefaults() 
+  {
+    table.setFont(null);
+    table.setGridColor(null);
+    table.setForeground(null);
+    table.setBackground(null);
+    table.setSelectionForeground(null);
+    table.setSelectionBackground(null);
+  }
+
+  protected void uninstallKeyboardActions() 
+  {
+  }
+
+  protected void uninstallListeners() 
+  {
+    table.removeFocusListener(focusListener);  
+    table.removeKeyListener(keyListener);
+    table.removeMouseListener(mouseInputListener);    
+  }
+
+  public void installUI(JComponent comp) 
+  {
+    table = (JTable)comp;
+    focusListener = createFocusListener();  
+    keyListener = createKeyListener();
+    mouseInputListener = createMouseInputListener();
+    installDefaults();
+    installKeyboardActions();
+    installListeners();
+  }
+
+  public void uninstallUI(JComponent c) 
+  {
+    uninstallListeners();
+    uninstallKeyboardActions();
+    uninstallDefaults();    
+  }
+
+  public void paint(Graphics gfx, JComponent ignored) 
+  {
+    int ncols = table.getColumnCount();
+    int nrows = table.getRowCount();
+    if (nrows == 0 || ncols == 0)
+      return;
+
+    Rectangle clip = gfx.getClipBounds();
+    TableColumnModel cols = table.getColumnModel();
+
+    int height = table.getRowHeight();
+    int x0 = 0, y0 = 0;
+    int x = x0;
+    int y = y0;
+
+    Dimension gap = table.getInterCellSpacing();
+    int ymax = clip.y + clip.height;
+    int xmax = clip.x + clip.width;
+
+    // paint the cell contents
+    for (int c = 0; c < ncols && x < xmax; ++c)
+      {
+        y = y0;
+        TableColumn col = cols.getColumn(c);
+        int width = col.getWidth();
+        int modelCol = col.getModelIndex();
+
+        for (int r = 0; r < nrows && y < ymax; ++r)
+          {
+            Rectangle bounds = new Rectangle(x, y, width, height);
+              if (bounds.intersects(clip))
+              {
+                TableCellRenderer rend = table.getCellRenderer(r, c);
+                Component comp = table.prepareRenderer(rend, r, c);
+                gfx.translate(x, y);
+                comp.setBounds(new Rectangle(0, 0, width, height));
+                comp.paint(gfx);
+                gfx.translate(-x, -y);
+              }
+              y += height;
+              if (gap != null)
+                y += gap.height;
+          }
+        x += width;
+        if (gap != null)
+          x += gap.width;
+      }
+
+    // tighten up the x and y max bounds
+    ymax = y;
+    xmax = x;
+
+    Color grid = table.getGridColor();    
+
+    // paint vertical grid lines    
+    if (grid != null && table.getShowVerticalLines())
+      {    
+        x = x0;
+        Color save = gfx.getColor();
+        gfx.setColor(grid);
+        boolean paintedLine = false;
+        for (int c = 0; c < ncols && x < xmax; ++c)
+          {
+            x += cols.getColumn(c).getWidth();;
+            if (gap != null)
+              x += gap.width;
+            gfx.drawLine(x, y0, x, ymax);
+            paintedLine = true;
+          }
+        gfx.setColor(save);
+      }
+
+    // paint horizontal grid lines    
+    if (grid != null && table.getShowHorizontalLines())
+      {    
+        y = y0;
+        Color save = gfx.getColor();
+        gfx.setColor(grid);
+        boolean paintedLine = false;
+        for (int r = 0; r < nrows && y < ymax; ++r)
+          {
+            y += height;
+            if (gap != null)
+              y += gap.height;
+            gfx.drawLine(x0, y, xmax, y);
+            paintedLine = true;
+          }
+        gfx.setColor(save);
+      }
+
+  }
+
+}
Index: javax/swing/table/DefaultTableCellRenderer.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/table/DefaultTableCellRenderer.java,v
retrieving revision 1.7
diff -u -r1.7 DefaultTableCellRenderer.java
--- javax/swing/table/DefaultTableCellRenderer.java     23 Apr 2004 17:37:47 
-0000      1.7
+++ javax/swing/table/DefaultTableCellRenderer.java     4 Sep 2004 21:12:55 
-0000
@@ -123,6 +123,20 @@
     if (value!=null)
       super.setText(value.toString());
     
+    setOpaque(true);
+    if (isSelected)
+      {
+        setBackground(table.getSelectionBackground());
+        setForeground(table.getSelectionForeground());
+      }
+    else
+      {
+        setBackground(table.getBackground());
+        setForeground(table.getForeground());
+      }
+
+    setEnabled(table.isEnabled());
+    setFont(table.getFont());
     return this;
   }
 
@@ -150,6 +164,11 @@
     // Does nothing.
   }
 
+  public void revalidate()
+  {
+    // Does nothing.
+  }
+
   /**
    * Overriden for performance.
    *
Index: javax/swing/table/DefaultTableColumnModel.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/table/DefaultTableColumnModel.java,v
retrieving revision 1.6
diff -u -r1.6 DefaultTableColumnModel.java
--- javax/swing/table/DefaultTableColumnModel.java      31 Jul 2004 23:47:30 
-0000      1.6
+++ javax/swing/table/DefaultTableColumnModel.java      4 Sep 2004 21:12:55 
-0000
@@ -44,6 +44,7 @@
 import java.util.EventListener;
 import java.util.Vector;
 import javax.swing.ListSelectionModel;
+import javax.swing.DefaultListSelectionModel;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.EventListenerList;
 import javax.swing.event.ListSelectionEvent;
@@ -103,25 +104,30 @@
    */
   public DefaultTableColumnModel()
   {
-    // TODO
+    tableColumns = new Vector();
+    setSelectionModel(new DefaultListSelectionModel());
+    columnMargin = 1;
+    columnSelectionAllowed = false;
   }
 
   /**
    * addColumn
    * @param value0 TODO
    */
-  public void addColumn(TableColumn value0)
+  public void addColumn(TableColumn col)
   {
-    // TODO
+    tableColumns.add(col);
+    invalidateWidthCache();
   }
 
   /**
    * removeColumn
    * @param value0 TODO
    */
-  public void removeColumn(TableColumn value0)
+  public void removeColumn(TableColumn col)
   {
-    // TODO
+    tableColumns.remove(col);
+    invalidateWidthCache();
   }
 
   /**
@@ -129,18 +135,20 @@
    * @param value0 TODO
    * @param value1 TODO
    */
-  public void moveColumn(int value0, int value1)
+  public void moveColumn(int i, int j)
   {
-    // TODO
+    Object tmp = tableColumns.get(i);
+    tableColumns.set(i, tableColumns.get(j));
+    tableColumns.set(j, tmp);
   }
 
   /**
    * setColumnMargin
    * @param value0 TODO
    */
-  public void setColumnMargin(int value0)
+  public void setColumnMargin(int m)
   {
-    // TODO
+    columnMargin = m;
   }
 
   /**
@@ -149,7 +157,7 @@
    */
   public int getColumnCount()
   {
-    return 0; // TODO
+    return tableColumns.size();
   }
 
   /**
@@ -158,7 +166,7 @@
    */
   public Enumeration getColumns()
   {
-    return null; // TODO
+    return tableColumns.elements();
   }
 
   /**
@@ -166,9 +174,9 @@
    * @param value0 TODO
    * @return int
    */
-  public int getColumnIndex(Object value0)
+  public int getColumnIndex(Object obj)
   {
-    return 0; // TODO
+    return tableColumns.indexOf(obj, 0);
   }
 
   /**
@@ -176,9 +184,9 @@
    * @param value0 TODO
    * @return TableColumn
    */
-  public TableColumn getColumn(int value0)
+  public TableColumn getColumn(int i)
   {
-    return null; // TODO
+    return (TableColumn) tableColumns.get(i);
   }
 
   /**
@@ -187,7 +195,7 @@
    */
   public int getColumnMargin()
   {
-    return 0; // TODO
+    return columnMargin;
   }
 
   /**
@@ -195,9 +203,17 @@
    * @param value0 TODO
    * @return int
    */
-  public int getColumnIndexAtX(int value0)
+  public int getColumnIndexAtX(int x)
   {
-    return 0; // TODO
+    for (int i = 0; i < tableColumns.size(); ++i)
+      {
+        int w = ((TableColumn)tableColumns.get(i)).getWidth();
+        if (0 <= x && x < w)
+          return i;
+        else
+          x -= w;
+      }
+    return -1;
   }
 
   /**
@@ -206,7 +222,9 @@
    */
   public int getTotalColumnWidth()
   {
-    return 0; // TODO
+    if (totalColumnWidth == -1)
+      recalcWidthCache();
+    return totalColumnWidth;
   }
 
   /**
@@ -236,9 +254,9 @@
    * setColumnSelectionAllowed
    * @param value0 TODO
    */
-  public void setColumnSelectionAllowed(boolean value0)
+  public void setColumnSelectionAllowed(boolean a)
   {
-    // TODO
+    columnSelectionAllowed = a;
   }
 
   /**
@@ -247,7 +265,7 @@
    */
   public boolean getColumnSelectionAllowed()
   {
-    return false; // TODO
+    return columnSelectionAllowed;
   }
 
   /**
@@ -272,9 +290,9 @@
    * addColumnModelListener
    * @param value0 TODO
    */
-  public void addColumnModelListener(TableColumnModelListener value0)
+  public void addColumnModelListener(TableColumnModelListener listener)
   {
-    // TODO
+    listenerList.add(TableColumnModelListener.class, listener);
   }
 
   /**
@@ -317,9 +335,11 @@
    * fireColumnSelectionChanged
    * @param value0 TODO
    */
-  protected void fireColumnSelectionChanged(ListSelectionEvent value0)
+  protected void fireColumnSelectionChanged(ListSelectionEvent evt)
   {
-    // TODO
+    EventListener [] listeners = getListeners(TableColumnModelListener.class);
+    for (int i = 0; i < listeners.length; ++i)
+      ((TableColumnModelListener)listeners[i]).columnSelectionChanged(evt);
   }
 
   /**
@@ -335,9 +355,9 @@
    * @param value0 TODO
    * @return EventListener[]
    */
-  public EventListener[] getListeners(Class value0)
+  public EventListener[] getListeners(Class klass)
   {
-    return null; // TODO
+    return listenerList.getListeners(klass);
   }
 
   /**
@@ -355,7 +375,7 @@
    */
   public void valueChanged(ListSelectionEvent value0)
   {
-    // TODO
+    fireColumnSelectionChanged(value0);
   }
 
   /**
@@ -372,7 +392,14 @@
    */
   protected void recalcWidthCache()
   {
-    // TODO
+    if (totalColumnWidth == -1)
+      {
+        totalColumnWidth = 0;
+        for (int i = 0; i < tableColumns.size(); ++i)
+          {
+            totalColumnWidth += ((TableColumn)tableColumns.get(i)).getWidth();
+          }
+      }
   }
 
   /**
@@ -380,6 +407,6 @@
    */
   private void invalidateWidthCache()
   {
-    // TODO
+    totalColumnWidth = -1;
   }
 }
Index: javax/swing/table/DefaultTableModel.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/table/DefaultTableModel.java,v
retrieving revision 1.5
diff -u -r1.5 DefaultTableModel.java
--- javax/swing/table/DefaultTableModel.java    12 Oct 2003 16:48:34 -0000      
1.5
+++ javax/swing/table/DefaultTableModel.java    4 Sep 2004 21:12:55 -0000
@@ -50,11 +50,6 @@
   implements Serializable
 {
   static final long serialVersionUID = 6680042567037222321L;
-
-       //-------------------------------------------------------------
-       // Variables --------------------------------------------------
-       //-------------------------------------------------------------
-
        /**
         * dataVector
         */
@@ -65,228 +60,216 @@
         */
        protected Vector columnIdentifiers;
 
-
-       //-------------------------------------------------------------
-       // Initialization ---------------------------------------------
-       //-------------------------------------------------------------
-
        /**
         * Constructor DefaultTableModel
         */
-       public DefaultTableModel() {
+  public DefaultTableModel() 
+  {
                this(0, 0);
-       } // DefaultTableModel()
+  }
 
        /**
         * Constructor DefaultTableModel
         * @param value0 TODO
         * @param value1 TODO
         */
-       public DefaultTableModel(int numRows, int numColumns) {
-
-               // Variables
-               int             columnIndex;
-               Vector          defaultNames;
-
-               // Create Column Names
-               defaultNames = new Vector();
-               for (columnIndex = 0; columnIndex < numColumns; columnIndex++) {
-                       
defaultNames.addElement(super.getColumnName(columnIndex));
-               } // for
-
-               // Setup Data
-//             setDataVector(defaultNames, numRows);
-
-       } // DefaultTableModel()
+  public DefaultTableModel(int numRows, int numColumns) 
+  {
+    Vector defaultNames = new Vector(numColumns);
+    Vector data = new Vector(numRows);
+    for (int i = 0; i < numColumns; i++) 
+      {
+        defaultNames.add(super.getColumnName(i));
+        Vector tmp = new Vector(numColumns);
+        tmp.setSize(numColumns);
+        data.add(tmp);
+      }          
+    setDataVector(defaultNames, data);
+  }
 
        /**
         * Constructor DefaultTableModel
         * @param value0 TODO
         * @param value1 TODO
         */
-       public DefaultTableModel(Vector columnNames, int numRows) {
+  public DefaultTableModel(Vector columnNames, int numRows) 
+  {
+    Vector data = new Vector();
+    int numColumns = 0;
 
-               // Variables
-               Vector          data;
-               Vector          rowData;
-               int             rowIndex;
-               int             numColumns;
-
-               // Create Data
-               data = new Vector();
-               if (columnNames == null) {
-                       numColumns = 0;
-               } else {
+    if (columnNames != null)
                        numColumns = columnNames.size();
-               } // if
-               for (rowIndex = 0; rowIndex < numRows; rowIndex++) {
-                       rowData = new Vector();
-                       rowData.setSize(numColumns);
-                       data.addElement(rowData);
-               } // for
 
-               // Setup Data
+    while (0 < numRows--) 
+      {
+        Vector rowData = new Vector();
+        rowData.setSize(numColumns);
+        data.add(rowData);
+      }
                setDataVector(data, columnNames);
-
-       } // DefaultTableModel()
+  }
 
        /**
         * Constructor DefaultTableModel
         * @param value0 TODO
         * @param value1 TODO
         */
-       public DefaultTableModel(Object[] columnNames, int numRows) {
+  public DefaultTableModel(Object[] columnNames, int numRows) 
+  {
                this(convertToVector(columnNames), numRows);
-       } // DefaultTableModel()
+  }
 
        /**
         * Constructor DefaultTableModel
         * @param value0 TODO
         * @param value1 TODO
         */
-       public DefaultTableModel(Vector data, Vector columnNames) {
+  public DefaultTableModel(Vector data, Vector columnNames) 
+  {
                setDataVector(data, columnNames);
-       } // DefaultTableModel()
+  }
 
        /**
         * Constructor DefaultTableModel
         * @param value0 TODO
         * @param value1 TODO
         */
-       public DefaultTableModel(Object[][] data, Object[] columnNames) {
+  public DefaultTableModel(Object[][] data, Object[] columnNames) 
+  {
                this(convertToVector(data), convertToVector(columnNames));
-       } // DefaultTableModel()
-
-
-       //-------------------------------------------------------------
-       // Methods ----------------------------------------------------
-       //-------------------------------------------------------------
+  }
 
        /**
         * getDataVector
         * @returns Vector
         */
-       public Vector getDataVector() {
+  public Vector getDataVector() 
+  {
                return dataVector;
-       } // getDataVector()
+  }
 
        /**
         * setDataVector
         * @param value0 TODO
         * @param value1 TODO
         */
-       public void setDataVector(Vector data, Vector columnNames) {
-
-               // Variables
-               int     rowIndex;
-               int     numRows;
-               int     numColumns;
-               Vector  columnVector;
-
-               // Set Data
+  public void setDataVector(Vector data, Vector columnNames) 
+  {
                dataVector = data;
                columnIdentifiers = columnNames;
-
-               // Check Data
-               numRows = data.size();
-               numColumns = columnNames.size();
-               for (rowIndex = 0; rowIndex < numRows; rowIndex++) {
-                       columnVector = (Vector) dataVector.get(rowIndex);
-                       columnVector.setSize(numColumns);
-               } // for
-
-       } // setDataVector()
+    for (int r = 0; r < data.size(); r++) {
+      ((Vector) dataVector.get(r)).setSize(columnNames.size());
+    }          
+  }
 
        /**
         * setDataVector
         * @param value0 TODO
         * @param value1 TODO
         */
-       public void setDataVector(Object[][] data, Object[] columnNames) {
-               setDataVector(convertToVector(data), 
convertToVector(columnNames));
-       } // setDataVector()
+  public void setDataVector(Object[][] data, Object[] columnNames) 
+  {
+    setDataVector(convertToVector(data), 
+                  convertToVector(columnNames));
+  }
 
        /**
         * newDataAvailable
         * @param value0 TODO
         */
-       public void newDataAvailable(TableModelEvent event) {
+  public void newDataAvailable(TableModelEvent event) 
+  {
                fireTableChanged(event);
-       } // newDataAvailable()
+  }
 
        /**
         * newRowsAdded
         * @param value0 TODO
         */
-       public void newRowsAdded(TableModelEvent event) {
-               // TODO
-       } // newRowsAdded()
+  public void newRowsAdded(TableModelEvent event) 
+  {
+    fireTableChanged(event);
+  }
 
        /**
         * rowsRemoved
         * @param value0 TODO
         */
-       public void rowsRemoved(TableModelEvent event) {
+  public void rowsRemoved(TableModelEvent event) 
+  {
                fireTableChanged(event);
-       } // rowsRemoved()
+  }
 
        /**
         * setColumnIdentifiers
         * @param value0 TODO
         */
-       public void setColumnIdentifiers(Vector columnIdentifiers) {
+  public void setColumnIdentifiers(Vector columnIdentifiers) 
+  {
                this.columnIdentifiers = columnIdentifiers;
                setColumnCount(columnIdentifiers.size());
-       } // setColumnIdentifiers()
+  }
 
        /**
         * setColumnIdentifiers
         * @param value0 TODO
         */
-       public void setColumnIdentifiers(Object[] columnIdentifiers) {
+  public void setColumnIdentifiers(Object[] columnIdentifiers) 
+  {
                setColumnIdentifiers(convertToVector(columnIdentifiers));
-       } // setColumnIdentifiers()
+  }
 
        /**
         * setNumRows
         * @param value0 TODO
         */
-       public void setNumRows(int numRows) {
+  public void setNumRows(int numRows) 
+  {
                setRowCount(numRows);
-       } // setNumRows()
+  }
 
        /**
         * setRowCount
         * @param value0 TODO
         */
-       public void setRowCount(int rowCount) {
-               // TODO
-       } // setRowCount()
+  public void setRowCount(int rowCount) 
+  {
+    dataVector.setSize(rowCount);
+    fireTableDataChanged();
+  }
 
        /**
         * setColumnCount
         * @param value0 TODO
         */
-       public void setColumnCount(int columnCount) {
-               // TODO
-       } // setColumnCount()
+  public void setColumnCount(int columnCount) 
+  {
+    for (int i = 0; i < dataVector.size(); ++i)
+      {
+        ((Vector) dataVector.get(i)).setSize(columnCount);
+      }
+    columnIdentifiers.setSize(columnCount);
+    fireTableDataChanged();
+  }
 
        /**
         * addColumn
         * @param value0 TODO
         */
-       public void addColumn(Object columnName) {
-               addColumn(columnName, new Vector(dataVector.size()));
-       } // addColumn()
+  public void addColumn(Object columnName) 
+  {
+    addColumn(columnName, (Object[]) null);
+  }
 
        /**
         * addColumn
         * @param value0 TODO
         * @param value1 TODO
         */
-       public void addColumn(Object columnName, Vector columnData) {
-               // TODO
-       } // addColumn()
+  public void addColumn(Object columnName, Vector columnData) 
+  {
+    addColumn(columnName, columnData == null ? null : columnData.toArray());
+  }
 
        /**
         * addColumn
@@ -294,16 +277,22 @@
         * @param value1 TODO
         */
        public void addColumn(Object columnName, Object[] columnData) {
-               // TODO
-       } // addColumn()
+    for (int i = 0; i < dataVector.size(); ++i)
+      {
+        ((Vector) dataVector.get(i)).add(columnData == null ? null : 
columnData[i]);
+      }
+    columnIdentifiers.add(columnName);
+    fireTableDataChanged();
+  }
 
        /**
         * addRow
         * @param value0 TODO
         */
        public void addRow(Vector rowData) {
-               // TODO
-       } // addRow()
+    dataVector.add(rowData);
+    fireTableDataChanged();
+  }
 
        /**
         * addRow
@@ -311,7 +300,7 @@
         */
        public void addRow(Object[] rowData) {
                addRow(convertToVector(rowData));
-       } // addRow()
+  }
 
        /**
         * insertRow
@@ -320,7 +309,8 @@
         */
        public void insertRow(int row, Vector rowData) {
                dataVector.add(row, rowData);
-       } // insertRow()
+    fireTableDataChanged();
+  }
 
        /**
         * insertRow
@@ -329,7 +319,7 @@
         */
        public void insertRow(int row, Object[] rowData) {
                insertRow(row, convertToVector(rowData));
-       } // insertRow()
+  }
 
        /**
         * moveRow
@@ -338,18 +328,12 @@
         * @param value2 TODO
         */
        public void moveRow(int startIndex, int endIndex, int toIndex) {
-
-               // Variables
-               int             index;
-               Vector  vector;
-
-               // Move Rows
-               for (index = 0; index < (endIndex - startIndex); index++) {
-                       vector = (Vector) dataVector.remove(startIndex);
+    for (int index = 0; index < (endIndex - startIndex); index++) {
+      Vector vector = (Vector) dataVector.remove(startIndex);
                        dataVector.add(toIndex, vector);
-               } // for
-
-       } // moveRow()
+    }
+    fireTableDataChanged();
+  }
 
        /**
         * removeRow
@@ -357,7 +341,8 @@
         */
        public void removeRow(int row) {
                dataVector.remove(row);
-       } // removeRow()
+    fireTableDataChanged();
+  }
 
        /**
         * getRowCount
@@ -365,7 +350,7 @@
         */
        public int getRowCount() {
                return dataVector.size();
-       } // getRowCount()
+  }
 
        /**
         * getColumnCount
@@ -373,7 +358,7 @@
         */
        public int getColumnCount() {
                return columnIdentifiers.size();
-       } // getColumnCount()
+  }
 
        /**
         * getColumnName
@@ -381,16 +366,14 @@
         * @returns String
         */
        public String getColumnName(int column) {
-
                // Check for Column
                if (columnIdentifiers == null || column >= getColumnCount()) {
                        return super.getColumnName(column);
-               } // if
+    }
 
                // Return Column name
                return (String) columnIdentifiers.get(column);
-
-       } // getColumnName()
+  }
 
        /**
         * isCellEditable
@@ -400,7 +383,7 @@
         */
        public boolean isCellEditable(int row, int column) {
                return true;
-       } // isCellEditable()
+  }
 
        /**
         * getValueAt
@@ -409,17 +392,8 @@
         * @returns Object
         */
        public Object getValueAt(int row, int column) {
-
-               // Variables
-               Vector  rowVector;
-
-               // Get Row Vector
-               rowVector = (Vector) dataVector.get(row);
-
-               // Get Data
-               return rowVector.get(column);
-
-       } // getValueAt()
+    return ((Vector) dataVector.get(row)).get(column);
+  }
 
        /**
         * setValueAt
@@ -428,18 +402,9 @@
         * @param value2 TODO
         */
        public void setValueAt(Object value, int row, int column) {
-
-               // Variables
-               Vector  rowVector;
-
-               // Get Row Vector
-               rowVector = (Vector) dataVector.get(row);
-
-               // Set Data
-               rowVector.remove(column);
-               rowVector.add(column, value);
-
-       } // setValueAt()
+    ((Vector) dataVector.get(row)).set(column, value);
+    fireTableDataChanged();
+  }
 
        /**
         * convertToVector
@@ -447,26 +412,13 @@
         * @returns Vector
         */
        protected static Vector convertToVector(Object[] data) {
-
-               // Variables
-               int     index;
-               Vector  vector;
-
-               // Check for null
-               if (data == null) {
+    if (data == null)
                        return null;
-               } // if
-
-               // Process
-               vector = new Vector();
-               for (index = 0; index < data.length; index++) {
-                       vector.add(data[index]);
-               } // for: index
-
-               // Return new Vector
+    Vector vector = new Vector(data.length);
+    for (int i = 0; i < data.length; i++) 
+      vector.add(data[i]);
                return vector;
-
-       } // convertToVector()
+  }
 
        /**
         * convertToVector
@@ -474,21 +426,11 @@
         * @returns Vector
         */
        protected static Vector convertToVector(Object[][] data) {
-
-               // Variables
-               int     index;
-               Vector  vector;
-
-               // Process
-               vector = new Vector();
-               for (index = 0; index < data.length; index++) {
-                       vector.add(convertToVector(data[index]));
-               } // for: index
-
-               // Return new Vector
+    if (data == null)
+      return null;
+    Vector vector = new Vector(data.length);
+    for (int i = 0; i < data.length; i++)
+      vector.add(convertToVector(data[i]));
                return vector;
-
-       } // convertToVector()
-
-
-} // DefaultTableModel
+  }
+}
Index: javax/swing/table/JTableHeader.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/table/JTableHeader.java,v
retrieving revision 1.4
diff -u -r1.4 JTableHeader.java
--- javax/swing/table/JTableHeader.java 31 Jul 2004 23:47:30 -0000      1.4
+++ javax/swing/table/JTableHeader.java 4 Sep 2004 21:12:55 -0000
@@ -38,28 +38,276 @@
 
 package javax.swing.table;
 
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Locale;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleComponent;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleText;
+import javax.accessibility.AccessibleValue;
 import javax.swing.JComponent;
 import javax.swing.JTable;
+import javax.swing.UIManager;
+import javax.swing.plaf.TableHeaderUI;
 
 public class JTableHeader extends JComponent
 {
-  protected class AccessibleJTableHeader
+  protected class AccessibleJTableHeader extends AccessibleJComponent
+  {
+    protected class AccessibleJTableHeaderEntry extends AccessibleContext
+      implements Accessible, AccessibleComponent
+    {
+      public void addFocusListener(FocusListener l)
+      {
+        throw new Error("not implemented");
+      }
+      public void addPropertyChangeListener(PropertyChangeListener l)
+      {
+        throw new Error("not implemented");
+      }
+      public boolean contains(Point p)
+      {
+        throw new Error("not implemented");
+      }
+      public AccessibleAction getAccessibleAction()
+      {
+        throw new Error("not implemented");
+      }
+      public Accessible getAccessibleAt(Point p)
+      {
+        throw new Error("not implemented");
+      }
+      public Accessible getAccessibleChild(int i)
+      {
+        throw new Error("not implemented");
+      }
+      public int getAccessibleChildrenCount()
+      {
+        throw new Error("not implemented");
+      }
+      public AccessibleComponent getAccessibleComponent()
+      {
+        throw new Error("not implemented");
+      }
+      public AccessibleContext getAccessibleContext()
+      {
+        throw new Error("not implemented");
+      }
+      public String getAccessibleDescription()
   {
-    protected class AccessibleJTableHeaderEntry
+        throw new Error("not implemented");
+      }
+      public int getAccessibleIndexInParent()
+      {
+        throw new Error("not implemented");
+      }
+      public String getAccessibleName()
     {
+        throw new Error("not implemented");
     }
+      public AccessibleRole getAccessibleRole()
+      {
+        throw new Error("not implemented");
+      }
+      public AccessibleSelection getAccessibleSelection()
+      {
+        throw new Error("not implemented");
+      }
+      public AccessibleStateSet getAccessibleStateSet()
+      {
+        throw new Error("not implemented");
+      }
+      public AccessibleText getAccessibleText()
+      {
+        throw new Error("not implemented");
+      }
+      public AccessibleValue getAccessibleValue()
+      {
+        throw new Error("not implemented");
+      }
+      public Color getBackground()
+      {
+        throw new Error("not implemented");
+      }
+      public Rectangle getBounds()
+      {
+        throw new Error("not implemented");
+      }
+      public Cursor getCursor()
+      {
+        throw new Error("not implemented");
+      }
+      public Font getFont()
+      {
+        throw new Error("not implemented");
+      }
+      public FontMetrics getFontMetrics(Font f)
+      {
+        throw new Error("not implemented");
+      }
+      public Color getForeground()
+      {
+        throw new Error("not implemented");
+      }
+      public Locale getLocale()
+      {
+        throw new Error("not implemented");
+      }
+      public Point getLocation()
+      {
+        throw new Error("not implemented");
+      }
+      public Point getLocationOnScreen()
+      {
+        throw new Error("not implemented");
+      }
+      public Dimension getSize()
+      {
+        throw new Error("not implemented");
+      }
+      public boolean isEnabled()
+      {
+        throw new Error("not implemented");
+      }
+      public boolean isFocusTraversable()
+      {
+        throw new Error("not implemented");
+      }
+      public boolean isShowing()
+      {
+        throw new Error("not implemented");
+      }
+      public boolean isVisible()
+      {
+        throw new Error("not implemented");
+      }
+      public void removeFocusListener(FocusListener l)
+      {
+        throw new Error("not implemented");
+      }
+      public void removePropertyChangeListener(PropertyChangeListener l)
+      {
+        throw new Error("not implemented");
+      }
+      public void requestFocus()
+      {
+        throw new Error("not implemented");
+      }
+      public void setAccessibleDescription(String s)
+      {
+        throw new Error("not implemented");
+      }
+      public void setAccessibleName(String s)
+      {
+        throw new Error("not implemented");
+      }
+      public void setBackground(Color c)
+      {
+        throw new Error("not implemented");
+      }
+      public void setBounds(Rectangle r)
+      {
+        throw new Error("not implemented");
+      }
+      public void setCursor(Cursor c)
+      {
+        throw new Error("not implemented");
+      }
+      public void setEnabled(boolean b)
+      {
+        throw new Error("not implemented");
+      }
+      public void setFont(Font f)
+      {
+        throw new Error("not implemented");
+      }
+      public void setForeground(Color c)
+      {
+        throw new Error("not implemented");
+      }
+      public void setLocation(Point p)
+      {
+        throw new Error("not implemented");
+      }
+      public void setSize(Dimension d)
+      {
+        throw new Error("not implemented");
+      }
+      public void setVisible(boolean b)
+      {
+        throw new Error("not implemented");
+      }
+    };
   }
 
   private static final long serialVersionUID = 5144633983372967710L;
 
-  protected TableColumnModel columnModel;
-  protected TableColumn draggedColumn;
-  protected int draggedDistance;
-  protected boolean reorderingAllowed;
-  protected boolean resizingAllowed;
-  protected TableColumn resizingColumn;
-  protected JTable table;
-  protected boolean updateTableInRealTime;
+  /**
+   * The accessibleContext property.
+   */
+  AccessibleContext accessibleContext;
+
+  /**
+   * The columnModel property.
+   */
+  TableColumnModel columnModel;
+
+  /**
+   * The draggedColumn property.
+   */
+  TableColumn draggedColumn;
+
+  /**
+   * The draggedDistance property.
+   */
+  int draggedDistance;
+
+  /**
+   * The opaque property.
+   */
+  boolean opaque;
+
+  /**
+   * The reorderingAllowed property.
+   */
+  boolean reorderingAllowed;
+
+  /**
+   * The resizingAllowed property.
+   */
+  boolean resizingAllowed;
+
+  /**
+   * The resizingColumn property.
+   */
+  TableColumn resizingColumn;
+
+  /**
+   * The table property.
+   */
+  JTable table;
+
+  /**
+   * The updateTableInRealTime property.
+   */
+  boolean updateTableInRealTime;
+
+  TableCellRenderer cellRenderer; 
 
   public JTableHeader()
   {
@@ -68,13 +316,258 @@
 
   public JTableHeader(TableColumnModel cm)
   {
-    super();
-
-    this.columnModel = cm == null ? createDefaultColumnModel() : cm;
+    accessibleContext = new AccessibleJTableHeader();
+    columnModel = cm == null ? createDefaultTableColumnModel() : cm; 
+    draggedColumn = null;
+    draggedDistance = 0;
+    opaque = true;
+    reorderingAllowed = true;
+    resizingAllowed = true;
+    resizingColumn = null;
+    table = null;
+    updateTableInRealTime = true;
+    cellRenderer = createDefaultRenderer();
+    updateUI();
   }
 
-  protected TableColumnModel createDefaultColumnModel()
+  protected TableColumnModel createDefaultTableColumnModel()
   {
     return new DefaultTableColumnModel();
   }
+
+
+  /**
+   * Get the value of the address@hidden #accessibleContext} property.
+   *
+   * @return The current value of the property
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    return accessibleContext;
+  }
+
+  /**
+   * Get the value of the address@hidden #columnModel} property.
+   *
+   * @return The current value of the property
+   */
+  public TableColumnModel getColumnModel()
+  {
+    return columnModel;
+  }
+
+  /**
+   * Get the value of the address@hidden #draggedColumn} property.
+   *
+   * @return The current value of the property
+   */
+  public TableColumn getDraggedColumn()
+  {
+    return draggedColumn;
+  }
+
+  /**
+   * Get the value of the address@hidden #draggedDistance} property.
+   *
+   * @return The current value of the property
+   */
+  public int getDraggedDistance()
+  {
+    return draggedDistance;
+  }
+
+  /**
+   * Get the value of the address@hidden #reorderingAllowed} property.
+   *
+   * @return The current value of the property
+   */
+  public boolean getReorderingAllowed()
+  {
+    return reorderingAllowed;
+  }
+
+  /**
+   * Get the value of the address@hidden #resizingAllowed} property.
+   *
+   * @return The current value of the property
+   */
+  public boolean getResizingAllowed()
+  {
+    return resizingAllowed;
+  }
+
+  /**
+   * Get the value of the address@hidden #resizingColumn} property.
+   *
+   * @return The current value of the property
+   */
+  public TableColumn getResizingColumn()
+  {
+    return resizingColumn;
+  }
+
+  /**
+   * Get the value of the address@hidden #table} property.
+   *
+   * @return The current value of the property
+   */
+  public JTable getTable()
+  {
+    return table;
+  }
+
+  /**
+   * Get the value of the address@hidden #updateTableInRealTime} property.
+   *
+   * @return The current value of the property
+   */
+  public boolean getUpdateTableInRealTime()
+  {
+    return updateTableInRealTime;
+  }
+
+  /**
+   * Get the value of the address@hidden #opaque} property.
+   *
+   * @return The current value of the property
+   */
+  public boolean isOpaque()
+  {
+    return opaque;
+  }
+
+  /**
+   * Set the value of the address@hidden #columnModel} property.
+   *
+   * @param c The new value of the property
+   */ 
+  public void setColumnModel(TableColumnModel c)
+  {
+    columnModel = c;
+  }
+
+  /**
+   * Set the value of the address@hidden #draggedColumn} property.
+   *
+   * @param d The new value of the property
+   */ 
+  public void setDraggedColumn(TableColumn d)
+  {
+    draggedColumn = d;
+  }
+
+  /**
+   * Set the value of the address@hidden #draggedDistance} property.
+   *
+   * @param d The new value of the property
+   */ 
+  public void setDraggedDistance(int d)
+  {
+    draggedDistance = d;
+  }
+
+  /**
+   * Set the value of the address@hidden #opaque} property.
+   *
+   * @param o The new value of the property
+   */ 
+  public void setOpaque(boolean o)
+  {
+    opaque = o;
+  }
+
+  /**
+   * Set the value of the address@hidden #reorderingAllowed} property.
+   *
+   * @param r The new value of the property
+   */ 
+  public void setReorderingAllowed(boolean r)
+  {
+    reorderingAllowed = r;
+  }
+
+  /**
+   * Set the value of the address@hidden #resizingAllowed} property.
+   *
+   * @param r The new value of the property
+   */ 
+  public void setResizingAllowed(boolean r)
+  {
+    resizingAllowed = r;
+  }
+
+  /**
+   * Set the value of the address@hidden #resizingColumn} property.
+   *
+   * @param r The new value of the property
+   */ 
+  public void setResizingColumn(TableColumn r)
+  {
+    resizingColumn = r;
+  }
+
+  /**
+   * Set the value of the address@hidden #table} property.
+   *
+   * @param t The new value of the property
+   */ 
+  public void setTable(JTable t)
+  {
+    table = t;
+  }
+
+  /**
+   * Set the value of the address@hidden #updateTableInRealTime} property.
+   *
+   * @param u The new value of the property
+   */ 
+  public void setUpdateTableInRealTime(boolean u)
+  {
+    updateTableInRealTime = u;
+  }
+
+  protected TableCellRenderer createDefaultRenderer()
+  {
+    return new DefaultTableCellRenderer();
+  }
+
+  public TableCellRenderer getDefaultRenderer()
+  {
+    return cellRenderer;
+  }
+
+  public Rectangle getHeaderRect(int column)
+  {
+    Rectangle r = getTable().getCellRect(-1, column, true);
+    r.height = getHeight();
+    return r;
+  }
+
+  protected String paramString()
+  {
+    return "JTableHeader";
+  }
+
+  // UI support
+
+  public String getUIClassID()
+  {
+    return "TableHeaderUI";
+  }
+
+  public TableHeaderUI getUI()
+  {
+    return (TableHeaderUI) ui;
+  }
+
+  public void setUI(TableHeaderUI u)
+  {
+    super.setUI(u);
+  }
+
+  public void updateUI()
+  {
+    setUI((TableHeaderUI) UIManager.getUI(this));
+  }
+
 }

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]