MouseListener doesn't appear to be working for me

前端 未结 3 1188
死守一世寂寞
死守一世寂寞 2021-01-15 11:20

I need to preface this with my instructor doesn\'t let us use IDE\'s. We use TextPad. I want to click on this label and it then change from \"H\" to \"T\". Currently when I

3条回答
  •  失恋的感觉
    2021-01-15 12:12

    That's because you need to add the mouse listener to your JLabel. In your constructor add:

    addMouseListener(this);
    

提交回复
热议问题