Dialog boxes stop displaying
I am unsure as to why, but in the middle of the program, the final line of code, will not display even though there are no seen errors. The program is still running, but the dialog box will not appear. Does this mean there is a limit as to how many boxes a program can have?
--Shojolove
import javax.swing.JOptionPane;
import java.util.Scanner;
public class AtTheBar {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
JOptionPane.showConfirmDialog(null, "Are you ready to play?", "Dungeon Master", 2, 3);
JOptionPane.showMessageDialog(null, " Write Down Your Base Ability Rolls: ", "Dungeon Master", JOptionPane.PLAIN_MESSAGE);
for(int i=0; i < 6 ; i++)
JOptionPane.showMessageDialog(null, ("Dice Roll ["+ (i+1) + "] : " + (int)(Math.random()*5+1)*4), "Dungeon Master", JOptionPane.PLAIN_MESSAGE);
//Dialog boxes showing base rolls. There is a long string of them.
JOptionPane.showInputDialog(null, "What is your Strength Stat?");
int intStrength = keyboard.nextInt();
int intDrkStg = intStrength/2;
JOptionPane.showMessageDialog(null, "Since you have been in a tavern for the past 2 hours. Because you've been drinking, your strength is now " + intDrkStg + ".");
}
}
Re: Dialog boxes stop displaying
I even changed up the code.
import javax.swing.JOptionPane;
import java.util.Scanner;
public class AtTheBar {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
JOptionPane.showConfirmDialog(null, "Are you ready to play?", "Dungeon Master", 2, 3);
JOptionPane.showMessageDialog(null, " Write Down Your Base Ability Rolls: ", "Dungeon Master", JOptionPane.PLAIN_MESSAGE);
for(int i=0; i < 6 ; i++)
JOptionPane.showMessageDialog(null, ("Dice Roll ["+ (i+1) + "] : " + (int)(Math.random()*5+1)*4), "Dungeon Master", JOptionPane.PLAIN_MESSAGE);
//Dialog boxes showing base rolls. There is a long string of them.
JOptionPane.showInputDialog(null, "What is your Strength Stat?");
String strStrength = keyboard.next();
int intStrength;
intStrength = Integer.parseInt(strStrength);
int intDrkStg = intStrength/2;
JOptionPane.showMessageDialog(null, "Since you have been in a tavern for the past 2 hours. Because you've been drinking, your strength is now " + intDrkStg + ".");
}}
Re: Dialog boxes stop displaying