- #1
- 2,136
- 2,711
I have written a program that will launch three JFrame windows if the user enters the correct things everywhere. In case there is a mistake, an error window will open, and then after 3s, the user will be re-directed to the window where he made the error.
The flowchart is attached.
Everything is working fine except the JFrame created by
The function
Here,
I want a simple window that shows:
"Wrong date/time."
"Program restarting..."
and then the thread goes to sleep for 3s, and calls
This is what I get when the user makes an error and
The JLabels just don't appear in the window.
Where am I going wrong?
The flowchart is attached.
Everything is working fine except the JFrame created by
makeGUI_4()
.The function
makeGUI_4()
looks something like this:
Java:
private void makeGUI_4() {
try {
jfrm4 = new JFrame();
jfrm4.setLayout(new FlowLayout());
jfrm4.setBounds(50, 50, 527, 351);
jfrm4.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jfrm4.setTitle("Error!");
jlb1 = new JLabel("Wrong date/time.");
jlb2 = new JLabel("Program restarting...");
jfrm4.add(jlb1);
jfrm4.add(jlb2);
jfrm4.setVisible(true);
Thread.sleep(3000);
jfrm4.setVisible(false);
makeGUI_2();
} catch (InterruptedException ex) {
Logger.getLogger(BuildGUI.class.getName()).log(Level.SEVERE, null, ex);
}
}
jlb1
and jlb2
are two JLabels declared as class variables. jfrm4
is a JFrame also declared as a class variable.I want a simple window that shows:
"Wrong date/time."
"Program restarting..."
and then the thread goes to sleep for 3s, and calls
makeGUI_2()
.This is what I get when the user makes an error and
makeGUI_4()
is called:The JLabels just don't appear in the window.
Where am I going wrong?