如何在鼠标输入/鼠标退出时更改按钮的图标图像?

Cod*_*gry 3 java icons swing jbutton mouselistener

我想更改鼠标输入和鼠标退出按钮的图标图像.

    private void jButton1MouseEntered(java.awt.event.MouseEvent evt) {    
    this.jButton1.setBackground(Color.red);
    this.jButton1.setForeground(Color.BLUE)
    }  ;
 private void jButton1MouseExited(java.awt.event.MouseEvent evt) {                                     
       this.jButton1.setBackground(Color.lightGray);
       this.jButton1.setForeground(Color.BLACK);

    }                                    
Run Code Online (Sandbox Code Playgroud)

请建议如何更改图标图像.

And*_*son 7

setRolloverIcon(Icon)(不需要MouseListener).