Results 1 to 3 of 3
  1. #1
    Shojolove is offline Member
    Join Date
    Sep 2012
    Location
    Naptown, IN
    Posts
    2
    Rep Power
    0

    Question 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 + ".");

    }

    }

  2. #2
    Shojolove is offline Member
    Join Date
    Sep 2012
    Location
    Naptown, IN
    Posts
    2
    Rep Power
    0

    Default 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 + ".");

    }}

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: Dialog boxes stop displaying

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. problem displaying print margins in dialog
    By simo_mon in forum Java 2D
    Replies: 2
    Last Post: 04-19-2012, 03:54 AM
  2. Dialog boxes closing on EVERY application.
    By Rtme in forum AWT / Swing
    Replies: 1
    Last Post: 05-17-2011, 08:54 PM
  3. dialog boxes
    By gedas in forum Java 2D
    Replies: 1
    Last Post: 02-19-2010, 12:23 PM
  4. average using dialog boxes.
    By sarahhh in forum New To Java
    Replies: 1
    Last Post: 01-22-2010, 11:10 PM
  5. Replies: 2
    Last Post: 11-22-2008, 06:30 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •