I have a dialog box that is:
JOptionPane.showMessageDialog(null,"Once medicine is given, measure temperature within 5 minutes." ,"Medication" ,JOptionPane.PLAIN_MESSAGE);
When the user presses 'ok', it goes straight to a Jframe that ask the user to input the temperature using a slider and then pressing a button that takes it to the next set of things.
Anyways, I want to create somekind of inivisble countdown after the user presses 'ok', so after 5 minutes of idleness on the Jframe menu, one warning dialog box should appear on top of the JFrame and says something like "NEED ATTENTION".
This reminds me of actionListener. but it will be invoked by non-physical element, 5 minutes, (not by any click of button).
So Maybe the code should be like:
JOptionPane.showMessageDialog(null,"Once medicine is given, measure temperature within 5 minutes." ,"Medication" ,JOptionPane.PLAIN_MESSAGE);
temperature_class temp = new temperature_class(); // going to a different class where the the Jframe is coded
if (time exceeds 5 minutes) { JOptionPane.showMessageDialog(null, "NEED attention", JOptionPane.WARNING_MESSAGE);}
else { (do nothing) }
Code works:
JOptionPane.showMessageDialog(null,"measure temp" ,"1" ,JOptionPane.PLAIN_MESSAGE);
int delay = 3000; //milliseconds
ActionListener taskPerformer = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
JOptionPane.showMessageDialog(null,"hurry." ,"Bolus Therapy Protocol" ,JOptionPane.PLAIN_MESSAGE); } };
new Timer(delay, taskPerformer).start();
temperature_class temp = new temperature_class();
However, I want it do it only once. So how do I invoke set.Repeats(false)?