簡體   English   中英

如何在鼠標輸入/鼠標退出時更改按鈕的圖標圖像?

[英]How to change icon image of button on mouse entered/mouse exit?

我想更改鼠標輸入和鼠標退出按鈕的圖標圖像。

    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);

    }                                    

請建議如何更改圖標圖像。

請參閱setRolloverIcon(Icon) (不需要MouseListener )。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM