diff --git a/pom.xml b/pom.xml
index b61048f..4669987 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,7 +60,7 @@
default-cli
- com.jesuspinar.miobjeto/com.jesuspinar.miobjeto.HelloApplication
+ com.jesuspinar.miobjeto/com.jesuspinar.miobjeto.App
app
app
app
diff --git a/src/main/java/com/jesuspinar/miobjeto/HelloApplication.java b/src/main/java/com/jesuspinar/miobjeto/App.java
similarity index 60%
rename from src/main/java/com/jesuspinar/miobjeto/HelloApplication.java
rename to src/main/java/com/jesuspinar/miobjeto/App.java
index bf314be..41c8a33 100644
--- a/src/main/java/com/jesuspinar/miobjeto/HelloApplication.java
+++ b/src/main/java/com/jesuspinar/miobjeto/App.java
@@ -7,16 +7,19 @@ import javafx.stage.Stage;
import java.io.IOException;
-public class HelloApplication extends Application {
+public class App extends Application {
@Override
public void start(Stage stage) throws IOException {
- FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml"));
- Scene scene = new Scene(fxmlLoader.load(), 320, 240);
- stage.setTitle("Hello!");
+
+ FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource("student-list.fxml"));
+
+ Scene scene = new Scene(fxmlLoader.load(), 400, 400);
+ stage.setTitle("Data");
stage.setScene(scene);
stage.show();
}
+
public static void main(String[] args) {
launch();
}
diff --git a/src/main/java/com/jesuspinar/miobjeto/HelloController.java b/src/main/java/com/jesuspinar/miobjeto/HelloController.java
deleted file mode 100644
index 69aa82b..0000000
--- a/src/main/java/com/jesuspinar/miobjeto/HelloController.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.jesuspinar.miobjeto;
-
-import javafx.fxml.FXML;
-import javafx.scene.control.Label;
-
-public class HelloController {
- @FXML
- private Label welcomeText;
-
- @FXML
- protected void onHelloButtonClick() {
- welcomeText.setText("Welcome to JavaFX Application!");
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/jesuspinar/miobjeto/controller/DataTbl.java b/src/main/java/com/jesuspinar/miobjeto/controller/DataTbl.java
new file mode 100644
index 0000000..5cb49cc
--- /dev/null
+++ b/src/main/java/com/jesuspinar/miobjeto/controller/DataTbl.java
@@ -0,0 +1,51 @@
+package com.jesuspinar.miobjeto.controller;
+
+import com.jesuspinar.miobjeto.model.PersonE;
+import com.jesuspinar.miobjeto.serializable.controller.ObjReader;
+import com.jesuspinar.miobjeto.serializable.model.People;
+import com.jesuspinar.miobjeto.serializable.model.Person;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TableView;
+import javafx.scene.control.cell.PropertyValueFactory;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ResourceBundle;
+
+public class DataTbl implements Initializable {
+ @FXML
+ public TableView tvData;
+ @FXML public TableColumn idColumn;
+ @FXML public TableColumn nameColumn;
+ @FXML public TableColumn ageColumn;
+ private People data;
+
+ private ObservableList getPeople() {
+ File file = new File("person.bin");
+
+ ObservableList people = null;
+
+ if (file.exists()) {
+ //Get data form the bin
+ data = (People) ObjReader.read(file);
+ System.out.println(data.toString());
+
+ people = FXCollections.observableArrayList(data.getData());
+ }
+ return people;
+ }
+
+ @Override
+ public void initialize(URL location, ResourceBundle resources) {
+ //Add data to colum
+ idColumn.setCellValueFactory(new PropertyValueFactory<>("idColumn"));
+ nameColumn.setCellValueFactory(new PropertyValueFactory<>("nameColumn"));
+ ageColumn.setCellValueFactory(new PropertyValueFactory<>("ageColumn"));
+
+ tvData.setItems(getPeople());
+ }
+}
diff --git a/src/main/java/com/jesuspinar/miobjeto/model/PersonE.java b/src/main/java/com/jesuspinar/miobjeto/model/PersonE.java
new file mode 100644
index 0000000..1e5dcb9
--- /dev/null
+++ b/src/main/java/com/jesuspinar/miobjeto/model/PersonE.java
@@ -0,0 +1,52 @@
+package com.jesuspinar.miobjeto.model;
+
+import javafx.beans.property.SimpleIntegerProperty;
+import javafx.beans.property.SimpleStringProperty;
+
+public class PersonE {
+ private SimpleIntegerProperty id;
+ private SimpleStringProperty name;
+ private SimpleIntegerProperty age;
+
+ public PersonE(int id, String name, int age) {
+ this.id = new SimpleIntegerProperty(id);
+ this.name = new SimpleStringProperty(name);
+ this.age = new SimpleIntegerProperty(age);
+ }
+
+ public int getId() {
+ return id.get();
+ }
+
+ public SimpleIntegerProperty idProperty() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id.set(id);
+ }
+
+ public String getName() {
+ return name.get();
+ }
+
+ public SimpleStringProperty nameProperty() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name.set(name);
+ }
+
+ public int getAge() {
+ return age.get();
+ }
+
+ public SimpleIntegerProperty ageProperty() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age.set(age);
+ }
+}
diff --git a/src/main/java/com/jesuspinar/miobjeto/serializable/model/People.java b/src/main/java/com/jesuspinar/miobjeto/serializable/model/People.java
index ae3f510..130e0b5 100644
--- a/src/main/java/com/jesuspinar/miobjeto/serializable/model/People.java
+++ b/src/main/java/com/jesuspinar/miobjeto/serializable/model/People.java
@@ -23,6 +23,10 @@ public class People implements Serializable {
return true;
}
+ public ArrayList getData() {
+ return data;
+ }
+
@Override
public String toString() {
return data.toString();
diff --git a/src/main/resources/com/jesuspinar/miobjeto/data-tbl.fxml b/src/main/resources/com/jesuspinar/miobjeto/data-tbl.fxml
new file mode 100644
index 0000000..6e457d9
--- /dev/null
+++ b/src/main/resources/com/jesuspinar/miobjeto/data-tbl.fxml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+