在鼠标上输入事件 [英] on mouse enter event
本文介绍了在鼠标上输入事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
希望我的按钮在鼠标输入事件上改变颜色我如何在java中执行
wanted my button to change color on mouse enter event how do i do in java
推荐答案
嘿,
因为你还没有提到你编码的是什么,
i告诉你这样做的一般步骤。
首先,您应该了解按钮的setBackground()属性,您可以在其中传递颜色代码作为设置按钮背景颜色的参数。 ex-setBackground(Color.green)
你可以了解它这里 [ ^ ]
其次,你必须处理鼠标-enter和鼠标退出事件(与按钮关联)并相应地更改按钮的背景属性(在退出时更改输入和恢复)。
您可以学习如何设置和处理这些事件这里 [ ^ ]
Happy Coding ..!
Hey,
As you haven''t mentioned what have you coded,
i am telling you the general steps of doing that.
Firstly, You should know about button''s setBackground() property where you can pass color code as an argument for setting background-color of button. ex- "setBackground(Color.green)"
You can learn about it Here[^]
Secondly, You have to handle the mouse-enter and mouse-exit events(associated with button) and change the background property of button accordingly(change on enter and restore on exit).
You can learn how to set and handle those events Here[^]
Happy Coding..!
这篇关于在鼠标上输入事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文