-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelloNiftySelectController.java
More file actions
45 lines (34 loc) · 1.34 KB
/
HelloNiftySelectController.java
File metadata and controls
45 lines (34 loc) · 1.34 KB
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
44
45
package org.sw7d.jme3.helloworld;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.NiftyEventSubscriber;
import de.lessvoid.nifty.controls.ButtonClickedEvent;
import de.lessvoid.nifty.controls.ListBox;
import de.lessvoid.nifty.controls.ListBoxSelectionChangedEvent;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;
import java.util.List;
public class HelloNiftySelectController implements ScreenController {
private final HelloNiftySelectApp app;
public HelloNiftySelectController(HelloNiftySelectApp app) {
this.app = app;
}
public void bind(Nifty nifty, Screen screen) {
ListBox theBox = screen.findNiftyControl("colorSelectionBox", ListBox.class);
for (String color : app.colorSelections.keySet()) {
theBox.addItem(color);
}
}
@NiftyEventSubscriber(id = "colorSelectionBox")
public void onMyListBoxSelectionChanged(final String id, final ListBoxSelectionChangedEvent<String> event) {
List<String> selection = event.getSelection();
app.colorSelected(selection.get(0));
}
@NiftyEventSubscriber(id = "doneButton")
public void onDoneButtonClicked(final String id, final ButtonClickedEvent event) {
app.doneSelecting();
}
public void onStartScreen() {
}
public void onEndScreen() {
}
}