java - How do I use layered pane? -


i wanted have backround image , on top of wanted have image user can click on , stuff.

how use properly?

b.addactionlistener(new actionlistener() {                   @override         public void actionperformed(actionevent e) {             p.setvisible(false);             p2.setvisible(false);             jlayeredpane lp2=new jlayeredpane();             jlayeredpane lp=new jlayeredpane();             imageicon image=new imageicon(getclass().getresource("800x800.jpg"));             jlabel lbl=new jlabel(image);             imageicon image2=new imageicon(getclass().getresource("imageyea.jpg"));             jlabel lbl2=new jlabel(image2);             lp2.add(lbl2);             lp.add(lbl);             add(lp2);             add(lp);         }     }); 

first off think don't need 2 layered panes. make 1 , on pane draw 2 pictures. overlapping predefined offset. can see how it's done in official oracle tutorial here: layeredpanedemo.java. if want make upper picture guess normal event handler job you.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -