/[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.41 by abalkiss, Tue Aug 9 19:46:55 2005 UTC revision 1.42 by langel, Thu Aug 11 20:19:19 2005 UTC
# Line 910  public class JTable extends JComponent Line 910  public class JTable extends JComponent
910     */     */
911    public int columnAtPoint(Point point)    public int columnAtPoint(Point point)
912    {    {
913      int x0 = getLocation().x;      if (point != null)
     int ncols = getColumnCount();  
     Dimension gap = getIntercellSpacing();  
     TableColumnModel cols = getColumnModel();  
     int x = point.x;  
       
     for (int i = 0; i < ncols; ++i)  
914        {        {
915          int width = cols.getColumn(i).getWidth() + (gap == null ? 0 : gap.width);          int x0 = getLocation().x;
916          if (0 <= x && x < width)          int ncols = getColumnCount();
917            return i;          Dimension gap = getIntercellSpacing();
918          x -= width;            TableColumnModel cols = getColumnModel();
919            int x = point.x;
920    
921            for (int i = 0; i < ncols; ++i)
922              {
923                int width = cols.getColumn(i).getWidth()
924                            + (gap == null ? 0 : gap.width);
925                if (0 <= x && x < width)
926                  return i;
927                x -= width;
928              }
929        }        }
       
930      return -1;      return -1;
931    }    }
932    
# Line 937  public class JTable extends JComponent Line 940  public class JTable extends JComponent
940     */     */
941    public int rowAtPoint(Point point)    public int rowAtPoint(Point point)
942    {    {
943      int y0 = getLocation().y;      if (point != null)
     int nrows = getRowCount();  
     Dimension gap = getIntercellSpacing();  
     int height = getRowHeight() + (gap == null ? 0 : gap.height);  
     int y = point.y;  
       
     for (int i = 0; i < nrows; ++i)  
944        {        {
945          if (0 <= y && y < height)          int y0 = getLocation().y;
946            return i;          int nrows = getRowCount();
947          y -= height;          Dimension gap = getIntercellSpacing();
948            int height = getRowHeight() + (gap == null ? 0 : gap.height);
949            int y = point.y;
950    
951            for (int i = 0; i < nrows; ++i)
952              {
953                if (0 <= y && y < height)
954                  return i;
955                y -= height;
956              }
957        }        }
         
958      return -1;      return -1;
959    }    }
960    

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

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