/[classpath]/classpath/javax/swing/JTable.java
ViewVC logotype

Diff of /classpath/javax/swing/JTable.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.61 by rabbit78, Fri Nov 18 21:46:19 2005 UTC revision 1.62 by rabbit78, Mon Nov 21 13:18:29 2005 UTC
# Line 1763  public class JTable Line 1763  public class JTable
1763      if ((event.getFirstRow() ==TableModelEvent.HEADER_ROW)      if ((event.getFirstRow() ==TableModelEvent.HEADER_ROW)
1764          && autoCreateColumnsFromModel)          && autoCreateColumnsFromModel)
1765    
1766          createDefaultColumnsFromModel();        createDefaultColumnsFromModel();
1767    
1768      // If the structure changes, we need to revalidate, since that might      // If the structure changes, we need to revalidate, since that might
1769      // affect the size parameters of the JTable. Otherwise we only need      // affect the size parameters of the JTable. Otherwise we only need
# Line 1796  public class JTable Line 1796  public class JTable
1796    {    {
1797      if (point != null)      if (point != null)
1798        {        {
         int x0 = getLocation().x;  
1799          int ncols = getColumnCount();          int ncols = getColumnCount();
1800          Dimension gap = getIntercellSpacing();          Dimension gap = getIntercellSpacing();
1801          TableColumnModel cols = getColumnModel();          TableColumnModel cols = getColumnModel();
# Line 1826  public class JTable Line 1825  public class JTable
1825    {    {
1826      if (point != null)      if (point != null)
1827        {        {
         int y0 = getLocation().y;  
1828          int nrows = getRowCount();          int nrows = getRowCount();
1829          int height = getRowHeight();          int height = getRowHeight();
1830          int y = point.y;          int y = point.y;
# Line 1984  public class JTable Line 1982  public class JTable
1982        }        }
1983    }    }
1984    
   
   
1985    public TableCellRenderer getCellRenderer(int row, int column)    public TableCellRenderer getCellRenderer(int row, int column)
1986    {    {
1987      TableCellRenderer renderer =      TableCellRenderer renderer =
# Line 2038  public class JTable Line 2034  public class JTable
2034                                     int row,                                     int row,
2035                                     int column)                                     int column)
2036    {    {
2037      boolean rsa = getRowSelectionAllowed();  
2038      boolean csa = getColumnSelectionAllowed();      boolean rowSelAllowed = getRowSelectionAllowed();
2039      boolean rs = rsa ? getSelectionModel().isSelectedIndex(row) : false;      boolean colSelAllowed = getColumnSelectionAllowed();
2040      boolean cs = csa ? columnModel.getSelectionModel().isSelectedIndex(column) : false;      boolean isSel = false;
2041      boolean isSelected = ((rsa && csa && rs && cs)      if (rowSelAllowed && colSelAllowed || !rowSelAllowed && !colSelAllowed)
2042                            || (rsa && !csa && rs)        isSel = isCellSelected(row, column);
2043                            || (!rsa && csa && cs));      else
2044              isSel = isRowSelected(row) && getRowSelectionAllowed()
2045               || isColumnSelected(column) && getColumnSelectionAllowed();
2046    
2047        // Determine the focused cell. The focused cell is the cell at the
2048        // leadSelectionIndices of the row and column selection model.
2049        ListSelectionModel rowSel = getSelectionModel();
2050        ListSelectionModel colSel = getColumnModel().getSelectionModel();
2051        boolean hasFocus = hasFocus() && isEnabled()
2052                           && rowSel.getLeadSelectionIndex() == row
2053                           && colSel.getLeadSelectionIndex() == column;
2054    
2055      return renderer.getTableCellRendererComponent(this,      return renderer.getTableCellRendererComponent(this,
2056                                                    dataModel.getValueAt(row,                                                    dataModel.getValueAt(row,
2057                                                                         convertColumnIndexToModel(column)),                                                                         convertColumnIndexToModel(column)),
2058                                                    isSelected,                                                    isSel,
2059                                                    false, // hasFocus                                                    hasFocus,
2060                                                    row, column);                                                    row, column);
2061    }    }
2062    
# Line 2216  public class JTable Line 2222  public class JTable
2222      int lo = lsm.getMinSelectionIndex();      int lo = lsm.getMinSelectionIndex();
2223      int hi = lsm.getMaxSelectionIndex();      int hi = lsm.getMaxSelectionIndex();
2224      int j = 0;      int j = 0;
     java.util.ArrayList ls = new java.util.ArrayList();  
2225      if (lo != -1 && hi != -1)      if (lo != -1 && hi != -1)
2226        {        {
2227          switch (lsm.getSelectionMode())          switch (lsm.getSelectionMode())

Legend:
Removed from v.1.61  
changed lines
  Added in v.1.62

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26