-
Notifications
You must be signed in to change notification settings - Fork 10
/
PruebaFXGUI.groovy
80 lines (63 loc) · 2.02 KB
/
PruebaFXGUI.groovy
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import javafx.application.Application;
import javafx.beans.value.*;
import javafx.event.EventHandler;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.*;
import javafx.scene.text.*;
import javafx.application.Platform;
import javafx.beans.property.*;
import com.dooapp.fxform.FXForm;
import javafx.collections.FXCollections;
import com.dooapp.fxform.view.*;
Platform.runLater(new Runnable() {
@Override
public void run() {
gui();
}
});
def gui() {
MyBean myBean = new MyBean();
Node fxForm = new FXForm(myBean);
fxForm.setSkin(FXFormSkinFactory.INLINE_FACTORY.createSkin(fxForm))
Stage stage = new Stage();
Scene scene = new Scene(new Group(fxForm));
stage.setScene(scene);
//scene.add(fxForm);
stage.show();
}
private class MyBean {
private final StringProperty name = new SimpleStringProperty();
private final ListProperty<TableBean> list = new SimpleListProperty<TableBean>(FXCollections.<TableBean>observableArrayList());
protected MyBean(String name) {
this.name.set(name);
this.list.addAll(new TableBean("Name 1", 99), new TableBean("Name 2", 98));
}
}
public class TableBean {
private final StringProperty name = new SimpleStringProperty();
private final IntegerProperty age = new SimpleIntegerProperty();
public TableBean(String name, int age) {
this.name.set(name);
this.age.set(age);
}
public String getName() {
return name.get();
}
public StringProperty nameProperty() {
return name;
}
public void setName(String name) {
this.name.set(name);
}
public int getAge() {
return age.get();
}
public IntegerProperty ageProperty() {
return age;
}
public void setAge(int age) {
this.age.set(age);
}
}