dashwall
12-12-2009, 06:12 PM
Ok I am having problems getting a Drop down box to populate correctly from an Array.
private void sailingCode()
{
String sailingCode=" ";
for(int row=0; row < oceanLink.length; row++) \\for loop running through array ocenLink
{
sailingCode= sailingCode+"\""+oceanLink[row][0]+"\""+", "+"\n";\\add to sailing code printing out as "code",
System.out.println(sailingCode);
}
String[] code= {sailingCode, "Please choose one"};\\String Array poputlated with sailingCode
String routeCode=(String)JOptionPane.showInputDialog(null, "Please choose a option", "Route Codes", JOptionPane.QUESTION_MESSAGE, null, code, code[0]);\\Dorp down list box for user to select code
System.out.println(routeCode);
Ok as I hope you can see from the above code is I want the code to list as you would expect a list box to but instean I get two options.
1) full list of codes from main Multi Array
2) choose one
Please ask for any more info.
dashwall
private void sailingCode()
{
String sailingCode=" ";
for(int row=0; row < oceanLink.length; row++) \\for loop running through array ocenLink
{
sailingCode= sailingCode+"\""+oceanLink[row][0]+"\""+", "+"\n";\\add to sailing code printing out as "code",
System.out.println(sailingCode);
}
String[] code= {sailingCode, "Please choose one"};\\String Array poputlated with sailingCode
String routeCode=(String)JOptionPane.showInputDialog(null, "Please choose a option", "Route Codes", JOptionPane.QUESTION_MESSAGE, null, code, code[0]);\\Dorp down list box for user to select code
System.out.println(routeCode);
Ok as I hope you can see from the above code is I want the code to list as you would expect a list box to but instean I get two options.
1) full list of codes from main Multi Array
2) choose one
Please ask for any more info.
dashwall