image - java moving jlabel with picture inside other jlabel bounds -


im programing game in netbeans in java have 2 jlabels

first jlabel1 want move around because has figure picture usualy use jlabel1.setlocation(x,y); // problem focuses on whole frame , starts coordinates upper-left corner of frame

i want coordinating within jlabel2 wich has picture inside coordinate 0,0 on upper-left of jlabel2 (upper-left of jlabel2 picture) possible , how

tnx answers

i figured out

first

int x=jlabel2.getx(); int y=jlabel2.gety();

so start coordiante @ coordinates of jlabel2

and add desired x , y related picture

int desired_x=20; int desired_y=20;

jlabel1.setlocation(x+desired_x,y+desired_y);


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -