Java Swing: change background color on mouse over

后端 未结 4 1667
半阙折子戏
半阙折子戏 2020-12-11 08:27

I\'ve implemented a simple mouse listener where the background color changes whenever the mouse enters the component (a JPanel), and it reverts back whenever the mouse leave

4条回答
  •  轮回少年
    2020-12-11 08:53

    I can't reproduce this behavior. Please edit your question to provide a short code sample that demonstrates the problem.

    When I create a JPanel, and put something in it, the JPanel does not get mouseExit when the mouse moves over a child component of the JPanel. I'm guessing that you've added MouseListeners to the children.

提交回复
热议问题