Created
January 27, 2018 01:00
-
-
Save samuelsonbrito/b98737b2c816042acbe2f0b72231e6e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package projetofxteste; | |
import java.net.URL; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.ResourceBundle; | |
import javafx.collections.FXCollections; | |
import javafx.collections.ObservableList; | |
import javafx.event.ActionEvent; | |
import javafx.fxml.FXML; | |
import javafx.fxml.Initializable; | |
import javafx.scene.control.Label; | |
import javafx.scene.control.ListView; | |
/** | |
* | |
* @author Samuelson | |
*/ | |
public class FXMLDocumentController implements Initializable { | |
@FXML | |
private ListView<Categoria> lvCategorias; | |
private List<Categoria> categorias = new ArrayList<>(); | |
private ObservableList<Categoria> obsCategorias; | |
@Override | |
public void initialize(URL url, ResourceBundle rb) { | |
// TODO | |
carregarCategorias(); | |
System.out.println("Iniciou"); | |
} | |
public void carregarCategorias(){ | |
Categoria categoria1 = new Categoria(1, "Bebidas"); | |
Categoria categoria2 = new Categoria(2, "Comidas"); | |
categorias.add(categoria1); | |
categorias.add(categoria2); | |
obsCategorias = FXCollections.observableArrayList(categorias); | |
lvCategorias.setItems(obsCategorias); | |
System.out.println(categorias); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment