Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

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.
[983 byte] By [shinevictim] at [2007-11-11 7:18:41]
# 1 Re: Please Please Help (arrays)
Your JOptionPane is displaying a "confirmation Dialog". Can you find a way to control this behavior? What does the API documentation tell you?
nspils at 2007-11-11 22:38:44 >