|
-
March 4th, 2009, 12:07 PM
#1
returning values from a list
i have to make this food selector for a uni project and i was wondering if someone could help me i need it to when i click on the desert list it puts the information in to some lables.
private void desertlstMouseClicked(java.awt.event.MouseEvent evt) {
Food selectedfood = (Food)foodlist.getSelectedValue();
if (selectedfood != null) {
outPrintInfo(foodlist);
}
}
private void outPrintInfo(Food e){
pricelbl.setText(""+e.getCalAmount());
calorieslbl.setText(""+e.getPrice());
}
this is what i have so far but it genarates a error :/
C:\Users\houlahan\MenuApplication\src\FoodSelectorGUI.java:84: cannot find symbol
symbol : method getSelectedValue()
location: class FoodList
Food selectedfood = (Food)foodlist.getSelectedValue();
C:\Users\houlahan\MenuApplication\src\FoodSelectorGUI.java:86: setAllTextFields(Food) in FoodSelectorGUI cannot be applied to (FoodList)
setAllTextFields(foodlist);
any ideas please?
thanks in advanced masterhoulahan.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|