I am trying to use comboboxes in a ticket payment screen for train tickets. I have two combo boxes. One for picking a route and the other for picking a time. What i want is when you pick a route in the first combo box, different departure times are availble in the time combobox depending on your route choice. I am trying to use if statements but its not working.
[JAVA = CODE]
routesCmb = new JComboBox();
routesCmb.addItem("Please pick a route");
routesCmb.addItem(route);
routesCmb.addItem(route2);
timesCmb = new JComboBox();
timesCmb.addItem("Please pick a time");
if routesCmb.SelectedItem(route);
{
timesCmb.addItem("3.00")
times.addITem("5.00")
}
[/code]
In the if statement, no selectedItem method exists, maybe
getSelectedItem() - return's an object... Could be compared to String. Useful
getSelectedIndex() - return's an element, depends on current
selected item... nth...
Update us,
Sukatoa