Hi, I have two co-dependent JFrames. A button in Frame1 opens up Frame2, and Frame2 accepts some input. The input in frame2 has some calculations done on it after a click event on frame1. The calculations are based on the location clicked in frame1.
What happens by default is; frame2 opens up, I give it some input, and then when I click on frame1 (to give frame2 the location to base its calculations on) frame2 disappears behind frame1, as it has lost its focus.
Is there a way of changing the focus so that when I click on frame1, the click will register, but frame2 will stay in focus and stay on top?
Thanks for your time,
posted 9 years ago
Have you checked whether JFrames have a requestFocus() method? If they have, then try putting something like:- in the actionListener for your button on Frame 1. If that doesn't work, have you tried "toFront()" and "toBack()" methods?