JOptionPane を使用した単純な JDialog があり、正常に動作します。しかし、JFrame を使用してより複雑なウィンドウを作成したいのですが、それを JDialog として機能させたいのですが、次のステップはウィンドウで選択されたものに依存するため、JFrame または JDialog が開いたときにコードを停止する必要があることを意味します。
これが私のクラスです。コードを停止するためにそれを実行する方法はありますか
public class MyFrame extends JDialog{
private static final long serialVersionUID = 1L;
public MyFrame() throws IOException {
setSize(600, 450);
dialogInit();
setTitle("Travel");
setVisible(true);
URL url = this.getClass().getResource("/images/travel1.png");
BufferedImage bf = ImageIO.read(url);
this.setContentPane(new backImage(bf));
JButton b = new JButton("Send");
JCheckBox tf=new JCheckBox("Country");
b.setBounds(318, 143, 98, 27);
tf.setBounds(235, 104, 150, 27);
add(b);
add(tf);
}
}