我想更改鼠标输入和鼠标退出时按钮的图标图像。
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);
}
请建议如何更改图标图像。
See setRolloverIcon(Icon) http://docs.oracle.com/javase/7/docs/api/javax/swing/AbstractButton.html#setRolloverIcon%28javax.swing.Icon%29(不需要MouseListener
).
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)