Results 1 to 2 of 2
  1. #1
    keycoffee is offline Member
    Join Date
    Jan 2010
    Posts
    9
    Rep Power
    0

    Default need help for JOptionPane....

    hi. I'm noe struggling with using JOptionPane. The question which I was assigned to do this.

    You are to write a program that will accept a positive integer in the range 0 to 9999, i.e. the integer has a maximum of 4 digits.s input and then outputs the digits one per line.

    The input/output must be via dialog boxes. The following are examples of the input/output you should produce:

    I don't know how to put the output but I will type it down.

    Homework 3(The title)

    Enter a positive 4 digit number
    [empty box where you can type the number] [Lets say 1234]

    OK[Button] Cancel[Button]



    Once click OK button, it will shows the next dialog

    Homework3 Answer[Title]

    The number was 1234
    The digits are
    1
    2
    3
    4
    OK[Button]

    So far I got this codes


    import javax.swing.*;
    public class Homework3{

    public static void main(String args[]){

    String number;

    number=JOptionPane.showInputDialog (null,"Enter a positive 4 digit");
    JOptionPane.showMessageDialog(null,"The number was" + number);




    }
    }

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    So read the API specs for the String class to see what methods are available and pick the ones that are likely to help you.

Similar Threads

  1. Help with JOptionPane
    By SwEeTAcTioN in forum New To Java
    Replies: 12
    Last Post: 11-03-2009, 04:12 AM
  2. JOptionpane
    By tommyyyy in forum New To Java
    Replies: 2
    Last Post: 03-20-2009, 08:33 AM
  3. JOptionPane
    By Mir in forum New To Java
    Replies: 5
    Last Post: 11-29-2008, 02:04 AM
  4. JOptionPane
    By whosadork in forum New To Java
    Replies: 2
    Last Post: 10-23-2008, 02:17 AM
  5. JOptionPane (customizing)
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-14-2008, 11:39 AM

Posting Permissions

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