当前位置: 技术问答>java相关
当鼠标置于按钮上时如何改变鼠标形状,比如由常规形状变为hand形状?
来源: 互联网 发布时间:2015-09-17
本文导语: 急用,谢谢! | void jButton1_mouseEntered(MouseEvent e) { this.setCursor(Cursor.HAND_CURSOR); } void jButton1_mouseExited(MouseEvent e) { this.setCursor(Cursor.DEFAULT_CURSOR); } | ...
急用,谢谢!
|
void jButton1_mouseEntered(MouseEvent e) {
this.setCursor(Cursor.HAND_CURSOR);
}
void jButton1_mouseExited(MouseEvent e) {
this.setCursor(Cursor.DEFAULT_CURSOR);
}
this.setCursor(Cursor.HAND_CURSOR);
}
void jButton1_mouseExited(MouseEvent e) {
this.setCursor(Cursor.DEFAULT_CURSOR);
}
|
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(MouseEvent e) {
jButton1_mouseEntered(e);
}
});
void jButton1_mouseEntered(MouseEvent e) {
jButton1.setCursor(new Cursor(Cursor.HAND_CURSOR));
}
public void mouseEntered(MouseEvent e) {
jButton1_mouseEntered(e);
}
});
void jButton1_mouseEntered(MouseEvent e) {
jButton1.setCursor(new Cursor(Cursor.HAND_CURSOR));
}
|
-------------------
|