Results 1 to 3 of 3
Thread: Dialog boxes stop displaying
- 09-07-2012, 05:22 AM #1
Member
- Join Date
- Sep 2012
- Location
- Naptown, IN
- Posts
- 2
- Rep Power
- 0
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 + ".");
}
}
- 09-07-2012, 05:44 AM #2
Member
- Join Date
- Sep 2012
- Location
- Naptown, IN
- Posts
- 2
- Rep Power
- 0
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 + ".");
}}
- 09-07-2012, 06:54 AM #3
Re: Dialog boxes stop displaying
Why do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
problem displaying print margins in dialog
By simo_mon in forum Java 2DReplies: 2Last Post: 04-19-2012, 02:54 AM -
Dialog boxes closing on EVERY application.
By Rtme in forum AWT / SwingReplies: 1Last Post: 05-17-2011, 07:54 PM -
dialog boxes
By gedas in forum Java 2DReplies: 1Last Post: 02-19-2010, 11:23 AM -
average using dialog boxes.
By sarahhh in forum New To JavaReplies: 1Last Post: 01-22-2010, 10:10 PM -
[SOLVED] Using dialog boxes and switch statements question
By hungdukie in forum New To JavaReplies: 2Last Post: 11-22-2008, 05:30 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks