In the main window I have an image. when I click on a point in that image, i have a JFrame pops up with a with an image which is the subimage of the orginal image, using the point selected (in the orginal) as the center of the subimage. Well right now the subimage in the new frame pops up on the screens orgin (top-left). I want to position this new frame such that the new frames center point is the point that was chosen on the screen ( thus the orgin would be [newFrame.getWidth() /2, newFrame.getHeight() /2]).
Manfred Leonhardt
Ranch Hand
Joined: Jan 09, 2001
Posts: 1492
posted
0
Hi Trippy, Just set its location! setSize( w,h ); setLocation( x, y ); setVisible( true ); Regards, Manfred.
trippyslippy
Greenhorn
Joined: May 07, 2001
Posts: 3
posted
0
well, i guess i should have been more clear...so here goes... the is the heirachy of the image in the GUI '=>' means that is contained in image => JLabel => JScrollPane => JPanel => JFrame => screen(monitor) and when i click on a point in the image how does that tranlate thru the heirachy? coz once i have that i can determin where to put the new frame on the screen thanks fro the speed reply thou.. danny
Manfred Leonhardt
Ranch Hand
Joined: Jan 09, 2001
Posts: 1492
posted
0
Hi Danny, I don't understand the problem ... Since your mouse callback knows the point clicked and it must have the frame because it pops it up. So just set the location before you set visible to true. Regards, Manfred.
trippyslippy
Greenhorn
Joined: May 07, 2001
Posts: 3
posted
0
Hey Manfred, well i figured out the problem. I had to findout the position of the container on the screen, ( that contained the image ) and add to that the point that was selected on the picture. That new point on the screen si where i have to draw the new frame. but thanks for you time Manfred, i really appreciate it, sincerely Danny
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.