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
35
36
37
38
39
40
41
42
43
|
package NET.worlds.console;
import java.util.Vector;
public class AvatarDialogTest implements AvatarDialogCallback {
private static final String[] components = new String[]{"Color", "Weather", "Height", "Shape"};
private static final String[] colors = new String[]{"Red", "Orange", "Yellow", "Green", "Blue", "Violet"};
private static final String[] weather = new String[]{"Sunny", "Cloudy", "Raining", "Snowing"};
private static final String[] heights = new String[]{"Short", "Medium", "Tall"};
private static final String[] shapes = new String[]{"Circle", "Rectangle", "Triangle"};
private static final String[][] items = new String[][]{colors, weather, heights, shapes};
private static int[] settings = new int[components.length];
@Override
public Vector<String> getComponents() {
return stringsToVector(components);
}
@Override
public Vector<String> getChoices(int index) {
return stringsToVector(items[index]);
}
@Override
public int getCurrentSelection(int index) {
return settings[index];
}
@Override
public void setCurrentSelection(int index, int choice) {
settings[index] = choice;
}
private static Vector<String> stringsToVector(String[] strings) {
Vector<String> v = new Vector<String>();
for (int i = 0; i < strings.length; i++) {
v.addElement(strings[i]);
}
return v;
}
}
|