I am trying to create a mouse adapter
to handle when a mouse button to print something. I have created a class and extended the mouse adapter. I override the mouseClicked method and now I to intialize the new object but i dont know what the argument is
What I tried
Created the MouseAdapterEvent where i override the mouseClicked method
class MouseAdapterEvents: MouseAdapter() {
override fun mouseClicked(e: java.awt.event.MouseEvent?) {
print("something")
}
}
then created the object in my other class
var a:MouseAdapterEvents
then in an async I'm waiting for mouse to be clicked a.mouseClicked()
but i dont know what the argument is.
What should i put there? And tbh i don't know how to initialize this var either.
You can initialize class by
var a:MouseAdapterEvents = MouseAdapterEvents()
and if you don't want to create new class you can use Object Expression
var a = object: MouseAdapter() {
override fun mouseClicked(e: java.awt.event.MouseEvent) {
print("something")
}
}