[英]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.