jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java
changeset 43077 785bbcd9812a
parent 43076 a2d90fcf0a70
child 43722 25ba19c20260
equal deleted inserted replaced
43076:a2d90fcf0a70 43077:785bbcd9812a
  1810             paintDropLines(g);
  1810             paintDropLines(g);
  1811             return;
  1811             return;
  1812         }
  1812         }
  1813 
  1813 
  1814         boolean ltr = table.getComponentOrientation().isLeftToRight();
  1814         boolean ltr = table.getComponentOrientation().isLeftToRight();
  1815 
  1815         Point upperLeft, lowerRight;
  1816         // compute the visible part of table which needs to be painted
  1816         // compute the visible part of table which needs to be painted
  1817         Rectangle visibleBounds = clip.intersection(bounds);
  1817         Rectangle visibleBounds = clip.intersection(bounds);
  1818         Point upperLeft = visibleBounds.getLocation();
  1818         upperLeft = visibleBounds.getLocation();
  1819         Point lowerRight = new Point(visibleBounds.x + visibleBounds.width - 1,
  1819         lowerRight = new Point(visibleBounds.x + visibleBounds.width - 1,
  1820                                      visibleBounds.y + visibleBounds.height - 1);
  1820                                visibleBounds.y + visibleBounds.height - 1);
  1821 
  1821 
  1822         int rMin = table.rowAtPoint(upperLeft);
  1822         int rMin = table.rowAtPoint(upperLeft);
  1823         int rMax = table.rowAtPoint(lowerRight);
  1823         int rMax = table.rowAtPoint(lowerRight);
  1824         // This should never happen (as long as our bounds intersect the clip,
  1824         // This should never happen (as long as our bounds intersect the clip,
  1825         // which is why we bail above if that is the case).
  1825         // which is why we bail above if that is the case).
  1832         // Replace this with the index of the last row.
  1832         // Replace this with the index of the last row.
  1833         if (rMax == -1) {
  1833         if (rMax == -1) {
  1834             rMax = table.getRowCount()-1;
  1834             rMax = table.getRowCount()-1;
  1835         }
  1835         }
  1836 
  1836 
       
  1837         // For FIT_WIDTH, all columns should be printed irrespective of
       
  1838         // how many columns are visible. So, we used clip which is already set to
       
  1839         // total col width instead of visible region
       
  1840         // Since JTable.PrintMode is not accessible
       
  1841         // from here, we aet "Table.printMode" in TablePrintable#print and
       
  1842         // access from here.
       
  1843         Object printMode = table.getClientProperty("Table.printMode");
       
  1844         if ((printMode == JTable.PrintMode.FIT_WIDTH)) {
       
  1845             upperLeft = clip.getLocation();
       
  1846             lowerRight = new Point(clip.x + clip.width - 1,
       
  1847                                    clip.y + clip.height - 1);
       
  1848         }
  1837         int cMin = table.columnAtPoint(ltr ? upperLeft : lowerRight);
  1849         int cMin = table.columnAtPoint(ltr ? upperLeft : lowerRight);
  1838         int cMax = table.columnAtPoint(ltr ? lowerRight : upperLeft);
  1850         int cMax = table.columnAtPoint(ltr ? lowerRight : upperLeft);
  1839         // This should never happen.
  1851         // This should never happen.
  1840         if (cMin == -1) {
  1852         if (cMin == -1) {
  1841             cMin = 0;
  1853             cMin = 0;