1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
public class ModeleDynamiqueObject_getränke extends AbstractListModel implements ComboBoxModel{
String selection = null;
public ModeleDynamiqueObject_getränke(){
super();
}
public Object getElementAt(int index) {
return Verwaltung.getDrinks().get(index).getName();
}
public int getSize() {
return Verwaltung.getDrinks().size();
}
public void setSelectedItem(Object anItem) {
selection = (String) anItem; // to select and register an
} // item from the pull-down list
// Methods implemented from the interface ComboBoxModel
public Object getSelectedItem() {
return selection; // to add the selection to the combo box
}
public void addgetraenk(Getraenk G){
Verwaltung.getDrinks().add(G);
}
public void removegetraenk(int index){
Verwaltung.getDrinks().remove(index);
fireContentsChanged(Verwaltung.getDrinks().get(index), index, index);
}
} |
Partager