JList

i have a Jlist that shows customer numbers and when clicked it displays custmer information from a dat file in a seperate panel (name, address etc), i seem to be having a problem with this piece of code any thoughts

class DisplayCustomerInformationListenerimplements ListSelectionListener{

/**

* Displays the information of the selected customer.

*

* @param event the event object.

*/

publicvoid valueChanged(ListSelectionEvent event){

if (! customerList.getValueIsAdjusting()){

int number = (String)customerList.getSelectedValue();

Customer customer = CustomerDatabase.getCustomer(number);

cDetailsPanel.removeAll();

cDetailsPanel.setVisible(false);

cDetailsPanel.add(customer.getPanel());// update the

cDetailsPanel.setVisible(true);// panel

statusTextArea.setText("Customer " + number

+" has been displayed");

}

}

}

int number = (String)customerList.getSelectedValue(); incompatible types

[1594 byte] By [static_firea] at [2007-10-3 6:02:06]
# 1
A String is not an int. Are you sure that's what you want? If so, converting to an int is trivial:int number = Integer.parseInt((String)customerList.getSelectedValue());
kablaira at 2007-7-15 0:44:15 > top of Java-index,Java Essentials,New To Java...
# 2
ah my gosh, im an idiot need sleep, thanks
static_firea at 2007-7-15 0:44:15 > top of Java-index,Java Essentials,New To Java...