What you want to do shouldn't be that difficult. Its been years since I did java and I haven't compiled this code but basically its something like
Code:
public static void main(String args[]) {
System.out.println("Enter your Centre: ");
String centre = input.nextLine();
System.out.println("Enter your mileage : ");
String milage = input.nextline();
try
{
FileWriter writer = new FileWriter("C:\\test.csv");
writer.append(distance);
writer.append(",);
writer.append(milage);
writer.append("/r/n"): //end of line flag
writer.flush();
writer.close();
}
catch(IOException e)
{
}
But as you wanted a drop down menu you need to create a combobox
Code:
String[] centreStrings = { "aaa", "bbb", "ccc", "ddd", "eee" };
JComboBox centreList = new JComboBox(centreStrings);
//can't edit the options it must be in the list
centreList.setEditable(false);
centreList.setSelectedIndex(0); //to select top of list "aaa"
There is a bit missing an actionlistener on the combo box but these bits and bats should put you in right direction at least.
Why do you want to do it in java though? and if I am well off I am sure someone will put it right
Bookmarks