Answer the question
In order to leave comments, you need to log in
How can I create a new JFrame in such a way that it blocks interaction with the old one?
In many programs, you can open an additional window, such as settings. And while it is open, it is impossible to influence the "parent" window in any way until the "child" window is closed. Plus, for all these windows, only 1 icon is allocated in the taskbar.
When I create windows, they are independent of each other and create one window per panel. Can this be fixed? If so, how?
Simplified project code that performs the specified task:
import java.awt.Component;
import javax.swing.JFrame;
public class Main extends Component {
public Main() {
JFrame settings = new JFrame();
settings.setSize(250, 250);
settings.setVisible(true);
}
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setSize(600, 600);
frame.add(new Main());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question