This is the code I can make the dialog window easy but how do I program the button that shows up with the dialog button? Is it possible? This is the image with the button:
package Millionaire;
import java.awt.Component;
import javax.swing.JOptionPane;
public class Time extends javax.swing.JFrame implements Runnable {
public static int timer;
public void run(){
try{
while(true){
if(DoYouWantToBeAMillionaire.timerActive){
if (timer == 0){
QuestionScreen.btnClicked = true;
QuestionScreen.answerCorrect = false;
LoseScreen LoseWindow = new LoseScreen();
LoseWindow.setVisible(true);
QuestionScreen.CloseScreen=true;
Component frame = null;
JOptionPane.showMessageDialog(frame, "SORRY,TIME'S UP","ERROR", JOptionPane.ERROR_MESSAGE);
break;
}
else {
System.out.println(timer);
Thread.sleep(1000);
timer -= 1;
}
}
else{
break;
}
}
}
catch(Exception e){
}
}
}