368 return (x <= bounds.width) &&
369 (x >= bounds.width - SCROLLBAR_WIDTH) &&
370 (y >= 0) &&
371 (y <= sbHeight);
372 }
373 return false;
374 }
375
376 boolean isInHorizSB(Rectangle bounds, int x, int y) {
377 if (hsbVis) {
378 assert hsb != null : "Horiz scrollbar is visible, yet is null?";
379
380 int sbWidth = vsbVis ? bounds.width - SCROLLBAR_WIDTH : bounds.width;
381 return (x <= sbWidth) &&
382 (x >= 0) &&
383 (y >= bounds.height - SCROLLBAR_WIDTH) &&
384 (y <= bounds.height);
385 }
386 return false;
387 }
388
389 void handleVSBEvent(MouseEvent e, Rectangle bounds, int x, int y) {
390 int sbHeight = hsbVis ? bounds.height - SCROLLBAR_WIDTH : bounds.height;
391
392 vsb.handleMouseEvent(e.getID(),
393 e.getModifiers(),
394 x - (bounds.width - SCROLLBAR_WIDTH),
395 y);
396 }
397
398 /*
399 * Called when items are added/removed.
400 * Update whether the scrollbar is visible or not, scrollbar values
401 */
402 private void updateScrollbars() {
403 boolean oldVsbVis = vsbVis;
404 vsbVis = vsb != null && items.size() > maxVisItems;
405 if (vsbVis) {
406 vsb.setValues(vsb.getValue(), getNumItemsDisplayed(),
407 vsb.getMinimum(), items.size());
408 }
|
368 return (x <= bounds.width) &&
369 (x >= bounds.width - SCROLLBAR_WIDTH) &&
370 (y >= 0) &&
371 (y <= sbHeight);
372 }
373 return false;
374 }
375
376 boolean isInHorizSB(Rectangle bounds, int x, int y) {
377 if (hsbVis) {
378 assert hsb != null : "Horiz scrollbar is visible, yet is null?";
379
380 int sbWidth = vsbVis ? bounds.width - SCROLLBAR_WIDTH : bounds.width;
381 return (x <= sbWidth) &&
382 (x >= 0) &&
383 (y >= bounds.height - SCROLLBAR_WIDTH) &&
384 (y <= bounds.height);
385 }
386 return false;
387 }
388 @SuppressWarnings("deprecation")
389 void handleVSBEvent(MouseEvent e, Rectangle bounds, int x, int y) {
390 int sbHeight = hsbVis ? bounds.height - SCROLLBAR_WIDTH : bounds.height;
391
392 vsb.handleMouseEvent(e.getID(),
393 e.getModifiers(),
394 x - (bounds.width - SCROLLBAR_WIDTH),
395 y);
396 }
397
398 /*
399 * Called when items are added/removed.
400 * Update whether the scrollbar is visible or not, scrollbar values
401 */
402 private void updateScrollbars() {
403 boolean oldVsbVis = vsbVis;
404 vsbVis = vsb != null && items.size() > maxVisItems;
405 if (vsbVis) {
406 vsb.setValues(vsb.getValue(), getNumItemsDisplayed(),
407 vsb.getMinimum(), items.size());
408 }
|