Please Please Help (arrays)


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Please Please Help (arrays)

  1. #1
    Join Date
    Nov 2005
    Posts
    1

    Please Please Help (arrays)

    Hi all, first of all nice forum. I have a task that i need to perform. I need to create and array which will store medicine when entered in by a user. the code i have so far is:

    import javax.swing.JOptionPane;

    public class ArrayDemo {
    public static void main(String[] args) {
    String[] anArray; // declare an array of integers

    anArray = new String[10]; // create an array of integers

    // assign a value to each array element and print
    for (int i=0; i<anArray.length; i++) {
    anArray[i] = JOptionPane.showInputDialog("Please enter the medicine"); // setting the element number i
    System.out.print(anArray[i] + " "); // showing it
    }
    System.out.println();
    }
    }

    BUT i need to change it so that when a user enters the medicine a YES_NO_CANCEL_OPTION window appears. i have been playin around wit the code but because i suck at java i jus cant get it. can someone please solve this or advise me please. thanks.

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    Your JOptionPane is displaying a "confirmation Dialog". Can you find a way to control this behavior? What does the API documentation tell you?

Similar Threads

  1. Control Arrays in VB.NET
    By Gary Nelson in forum .NET
    Replies: 277
    Last Post: 10-01-2003, 12:00 AM
  2. Copy/Duplicate Arrays
    By Steve Cochran in forum .NET
    Replies: 8
    Last Post: 10-18-2002, 12:10 PM
  3. Replies: 15
    Last Post: 05-09-2001, 04:40 AM
  4. VB Arrays and memory allocation
    By Brian Leung in forum VB Classic
    Replies: 12
    Last Post: 06-20-2000, 03:06 PM
  5. VB Arrays and memory allocation
    By Brian Leung in forum VB Classic
    Replies: 0
    Last Post: 06-20-2000, 09:47 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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center