java - How to add MouseEvent inside the Anonymous Class Listener? -


so im making puzzle game in jframe, dont know how use mouseevent , put inside anonymous class listener. , problem. need move images center of frame , guess images.

    //p5 components(continue frame)     imageicon pic1st = new imageicon("c:\\java pics\\w.png");     jlabel pic1st0 = new jlabel(pic1st);     jlabel level = new jlabel("level:" + l);     jlabel score = new jlabel("score:" + s);     jlabel time = new jlabel("time:" + t); 

and anonymous class listener

//this part of code want put mouseevent.

continue1.addactionlistener(new actionlistener() {          @override         public void actionperformed(actionevent arg0) {             // todo auto-generated method stub             f.add(p5);             f.remove(p20);             f.setvisible(true);             f.revalidate();             f.repaint();         }     }); //where put mouseevent here? 

any appreciated.

why need mouseevent here? need put image under mouse? you're centering it...anyway, way track mouse events add mouseadapter or mouselistener component need track mouseevents. see how write mouselistener.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -