1 package nl.tudelft.goal.ut2004.visualizer.gui.widgets;
2
3 import javax.swing.JComboBox;
4 import javax.swing.JPanel;
5
6 import nl.tudelft.goal.ut2004.visualizer.util.SelectableWayPoint;
7
8
9 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint;
10 import cz.cuni.amis.pogamut.ut2004.communication.worldview.map.Waypoint;
11
12
13
14
15
16
17
18
19 public class SuggestionField extends JPanel {
20
21 private final JComboBox combobox;
22 private final SuggestionModel model;
23 private final SuggestionFieldEditor editor;
24
25 public SuggestionField(SuggestionModel model) {
26 this.model = model;
27 this.combobox = new JComboBox(model);
28 this.editor = new SuggestionFieldEditor(combobox, model);
29
30 this.combobox.setEditor(editor);
31 this.combobox.setEditable(true);
32 this.combobox.setSelectedIndex(-1);
33
34 add(combobox);
35 }
36
37 public void setSelectedItem(Object item) {
38 combobox.setSelectedItem(item);
39 editor.setItem(item);
40 model.setSelectedItem(item);
41 }
42
43 public Object getSelecteditem() {
44 return combobox.getSelectedItem();
45 }
46
47 }