317 * Paints the scrollbar thumb. 318 * 319 * @param context context for the component being painted 320 * @param g {@code Graphics} object used for painting 321 * @param thumbBounds bounding box for the thumb 322 */ 323 protected void paintThumb(SynthContext context, Graphics g, 324 Rectangle thumbBounds) { 325 SynthLookAndFeel.updateSubregion(context, g, thumbBounds); 326 int orientation = scrollbar.getOrientation(); 327 context.getPainter().paintScrollBarThumbBackground(context, g, thumbBounds.x, 328 thumbBounds.y, thumbBounds.width, thumbBounds.height, 329 orientation); 330 context.getPainter().paintScrollBarThumbBorder(context, g, thumbBounds.x, 331 thumbBounds.y, thumbBounds.width, thumbBounds.height, 332 orientation); 333 } 334 335 /** 336 * A vertical scrollbar's preferred width is the maximum of 337 * preferred widths of the (non <code>null</code>) 338 * increment/decrement buttons, 339 * and the minimum width of the thumb. The preferred height is the 340 * sum of the preferred heights of the same parts. The basis for 341 * the preferred size of a horizontal scrollbar is similar. 342 * <p> 343 * The <code>preferredSize</code> is only computed once, subsequent 344 * calls to this method just return a cached size. 345 * 346 * @param c the <code>JScrollBar</code> that's delegating this method to us 347 * @return the preferred size of a Basic JScrollBar 348 * @see #getMaximumSize 349 * @see #getMinimumSize 350 */ 351 @Override 352 public Dimension getPreferredSize(JComponent c) { 353 Insets insets = c.getInsets(); 354 return (scrollbar.getOrientation() == JScrollBar.VERTICAL) 355 ? new Dimension(scrollBarWidth + insets.left + insets.right, 48) 356 : new Dimension(48, scrollBarWidth + insets.top + insets.bottom); 357 } 358 359 /** 360 * {@inheritDoc} 361 */ 362 @Override 363 protected Dimension getMinimumThumbSize() { 364 if (!validMinimumThumbSize) { 365 if (scrollbar.getOrientation() == JScrollBar.VERTICAL) { 366 minimumThumbSize.width = scrollBarWidth; | 317 * Paints the scrollbar thumb. 318 * 319 * @param context context for the component being painted 320 * @param g {@code Graphics} object used for painting 321 * @param thumbBounds bounding box for the thumb 322 */ 323 protected void paintThumb(SynthContext context, Graphics g, 324 Rectangle thumbBounds) { 325 SynthLookAndFeel.updateSubregion(context, g, thumbBounds); 326 int orientation = scrollbar.getOrientation(); 327 context.getPainter().paintScrollBarThumbBackground(context, g, thumbBounds.x, 328 thumbBounds.y, thumbBounds.width, thumbBounds.height, 329 orientation); 330 context.getPainter().paintScrollBarThumbBorder(context, g, thumbBounds.x, 331 thumbBounds.y, thumbBounds.width, thumbBounds.height, 332 orientation); 333 } 334 335 /** 336 * A vertical scrollbar's preferred width is the maximum of 337 * preferred widths of the (non {@code null}) 338 * increment/decrement buttons, 339 * and the minimum width of the thumb. The preferred height is the 340 * sum of the preferred heights of the same parts. The basis for 341 * the preferred size of a horizontal scrollbar is similar. 342 * <p> 343 * The {@code preferredSize} is only computed once, subsequent 344 * calls to this method just return a cached size. 345 * 346 * @param c the {@code JScrollBar} that's delegating this method to us 347 * @return the preferred size of a Basic JScrollBar 348 * @see #getMaximumSize 349 * @see #getMinimumSize 350 */ 351 @Override 352 public Dimension getPreferredSize(JComponent c) { 353 Insets insets = c.getInsets(); 354 return (scrollbar.getOrientation() == JScrollBar.VERTICAL) 355 ? new Dimension(scrollBarWidth + insets.left + insets.right, 48) 356 : new Dimension(48, scrollBarWidth + insets.top + insets.bottom); 357 } 358 359 /** 360 * {@inheritDoc} 361 */ 362 @Override 363 protected Dimension getMinimumThumbSize() { 364 if (!validMinimumThumbSize) { 365 if (scrollbar.getOrientation() == JScrollBar.VERTICAL) { 366 minimumThumbSize.width = scrollBarWidth; |