Your problem in next:
You set Cursor to sample
instance(JFrame
), not to JButton
, for setting cursor on button change setCursor (new Cursor (Cursor.HAND_CURSOR));
to ((JComponent)e.getSource()).setCursor (new Cursor (Cursor.HAND_CURSOR));
Also for that purposes you needn't to use MouseListener
you can just use:
b1.setCursor(new Cursor (Cursor.HAND_CURSOR));