public void mousePressed(MouseEvent e) { super.mousePressed(e); Rectangle r = getTrackBounds(); scrollbar.repaint(r.x, r.y, r.width, r.height); }