void (JSlider slider) { super.installListeners(slider); mouseListener = new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { setProperty(e, PRESSED_PROPERTY, Boolean.TRUE); } @Override public void mouseReleased(MouseEvent e) { setProperty(e, PRESSED_PROPERTY, Boolean.FALSE); } @Override public void mouseEntered(MouseEvent e) { setProperty(e, HOVER_PROPERTY, Boolean.TRUE); } @Override public void mouseExited(MouseEvent e) { setProperty(e, HOVER_PROPERTY, Boolean.FALSE); } private static void setProperty(MouseEvent e, String property, Boolean value) { JComponent c = (JComponent)e.getComponent(); c.putClientProperty(property, value); c.repaint(); } }; slider.addMouseListener(mouseListener); }