Is there an actionMap-like thing for mouse clicks?
Thank you in advance, ive tried google, but did not find anything :/
Not that I know of - I think you just have to get down & dirty with MouseListener, MouseWheelListener, and MouseMotionListener
I think i get the JPanel crash with MouseListener too, tried it a few days, ago.. and did stuff correct i think.
If it crashed then you were doing something wrong - the whole of Swing relies on mouse listening, and its really solid code. Try again?
Tried again now, did
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
public class test extends JPanel implements MouseListener
and all of the method: mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased
I think the trouble is caused by focusing, i had trouble with KeyListener earlier on, and had to use keybindings. You sure its nothing similar for mouse?
Nevermind, i forgot to add the addMouseListener(this); line. Sorry for my stupidity, thought i had it all.
Thanks anyway! :)
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.