< prev index next >

src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java

Print this page




 454                     int height = Math.min(BUFFER_SIZE - yOffset,
 455                                           maxY - yCounter);
 456 
 457                     g.drawImage(image, xCounter, yCounter,
 458                                 xCounter + width, yCounter + height,
 459                                 xOffset, yOffset,
 460                                 xOffset + width, yOffset + height, null);
 461                     if (yOffset != 0) {
 462                         yCounter -= yOffset;
 463                         yOffset = 0;
 464                     }
 465                 }
 466                 if (xOffset != 0) {
 467                     xCounter -= xOffset;
 468                     xOffset = 0;
 469                 }
 470             }
 471         }
 472 
 473         /**
 474          * Actually renders the grid into the Graphics <code>g</code>.
 475          */
 476         private void paintGrid(Graphics g, Color fg, Color bg) {
 477             Rectangle clipRect = g.getClipBounds();
 478             g.setColor(bg);
 479             g.fillRect(clipRect.x, clipRect.y, clipRect.width,
 480                        clipRect.height);
 481             g.setColor(fg);
 482             g.translate(clipRect.x, clipRect.y);
 483             int width = clipRect.width;
 484             int height = clipRect.height;
 485             int xCounter = clipRect.x % 2;
 486             for (int end = width - height; xCounter < end; xCounter += 2) {
 487                 g.drawLine(xCounter, 0, xCounter + height, height);
 488             }
 489             for (int end = width; xCounter < end; xCounter += 2) {
 490                 g.drawLine(xCounter, 0, width, width - xCounter);
 491             }
 492 
 493             int yCounter = ((clipRect.x % 2) == 0) ? 2 : 1;
 494             for (int end = height - width; yCounter < end; yCounter += 2) {


 454                     int height = Math.min(BUFFER_SIZE - yOffset,
 455                                           maxY - yCounter);
 456 
 457                     g.drawImage(image, xCounter, yCounter,
 458                                 xCounter + width, yCounter + height,
 459                                 xOffset, yOffset,
 460                                 xOffset + width, yOffset + height, null);
 461                     if (yOffset != 0) {
 462                         yCounter -= yOffset;
 463                         yOffset = 0;
 464                     }
 465                 }
 466                 if (xOffset != 0) {
 467                     xCounter -= xOffset;
 468                     xOffset = 0;
 469                 }
 470             }
 471         }
 472 
 473         /**
 474          * Actually renders the grid into the Graphics {@code g}.
 475          */
 476         private void paintGrid(Graphics g, Color fg, Color bg) {
 477             Rectangle clipRect = g.getClipBounds();
 478             g.setColor(bg);
 479             g.fillRect(clipRect.x, clipRect.y, clipRect.width,
 480                        clipRect.height);
 481             g.setColor(fg);
 482             g.translate(clipRect.x, clipRect.y);
 483             int width = clipRect.width;
 484             int height = clipRect.height;
 485             int xCounter = clipRect.x % 2;
 486             for (int end = width - height; xCounter < end; xCounter += 2) {
 487                 g.drawLine(xCounter, 0, xCounter + height, height);
 488             }
 489             for (int end = width; xCounter < end; xCounter += 2) {
 490                 g.drawLine(xCounter, 0, width, width - xCounter);
 491             }
 492 
 493             int yCounter = ((clipRect.x % 2) == 0) ? 2 : 1;
 494             for (int end = height - width; yCounter < end; yCounter += 2) {
< prev index next >