Hello in this Java programming video, we are going to take a look at mouse event. So make sure you have gone through the simple example tutorial and the video covering keyboard events because we'll be extending that. Okay, so if you may, assuming you've got the event info need to implement from a nother class so we're going to do mass listener. This will allow us to listen to measurements. We are saying that there are you know, this unimplemented methods we'll be adding them really and do this like okay, you can actually just do it the shorthand method click Add unimplemented go down, they add or for the unimplemented Don't have to put this at override, it automatically puts it. And a few things I'm actually going to change is put a do not like Egyptian brace style.
Going to get rid of that. Okay, so we've got, you know, a few different events. So this is when a method they clicked a button. When a button has been pressed, a one has been released when you the masses entered the actual particular state, and when it was a worthless dude clicked. So when we click it, what I'm going to do, just do something really simple in x equals e dot Get x at least get the position of, you know the x coordinates. When we click it, for example, to do something and there's like a whole heap of you know various methods I'll provide the link with this video we can see all the different ones.
But once you guys said so you know the process is very similar could give you a look, he likes to click cans and he clicks. You can get you know which button it is X and Y position relative to the screen like so much. We're going to keep it simple. And on the system during to learn and x ROI. I'm going to add a little colon in between I need one more. Boom done.
There we go. So right now That's pretty cool. Just means over a click, we get the coordinates. And that is it. That's how you, you know, handle mesmerism. So you could put this in any one of these as an extra task or recommend you put these in each one.
See how that varies. In the previous videos, we spoke about this week paint method, which when you call it, it basically initiates this paint, again, which allows you to, you know, redraw stuff onto the screen. So as an extra task we're going to do is habit so when you click for example, it doesn't system out these values. it updates the string. So how about that if you have any questions, feel free to reach out and I look forward seeing you in the next awesome Java tutorial.