1

scene/stage gets build up in der main class. I use fxml for the design and fill it with the controller. just "name" gets filled and "type" is empty.

Project(name,type Controller:

imports...
public class Controller implements Initializable{

@FXML private TableView<Project> tabelle;
@FXML private TableColumn<Project,String> name;
@FXML private TableColumn<Project,String> type;

public void initialize(URL location, ResourceBundle resources) {
    type.setCellValueFactory(new PropertyValueFactory<Project, String>("type"));
    name.setCellValueFactory(new PropertyValueFactory<Project, String>("name"));


    tabelle.getItems().setAll(parseList());
}

protected List<Project> parseList(){
    List<DiaryEntry> lisz = entries.ent();
    List<Project> data =
            FXCollections.observableArrayList(

                    new Project("gw2","private"),
                    new Project("menu","private"),
                    new Project("gw2","internal"),
                    new Project("dance","internal")
            );
    return data;
}

FXML:

<VBox fx:id="a" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="800.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Controller">
<children>
    <TableView fx:id="tabelle" editable="true" layoutY="99.0" prefHeight="701.0" prefWidth="470.0">
     <columns>
        <TableColumn fx:id="name" prefWidth="150.0" text="CDNA" />
        <TableColumn fx:id="type" prefWidth="150.0" text="Type" />
     </columns></TableView>
</children>

and here is the table: https://i.stack.imgur.com/tTFG9.jpg (normal javafx table but just "NAME" is filled) PROJECT: Updated

import java.util.Objects;

public class Project {

private String name;
private String type;

public Project(String name, String type) {
    this.name = name;
    this.type = type;
}

public String getName() {
    return name;
}

public boolean isInternal() {
    return "internal".equals(type);
}

@Override
public boolean equals(Object obj) {
    if (obj instanceof Project) {
        Project that = (Project) obj;
        return Objects.equals(name, that.name) && Objects.equals(type, that.type);
    }
    return false;
}

@Override
public int hashCode() {
    return Objects.hash(name, type);
}

}

sparksen
  • 23
  • 5
  • Post the rest of the `Project` class. That is almost certainly where the problem is. – James_D Jul 25 '17 at 21:55
  • yeah ty:D but thats pretty badXD i am not allowed to change the object class(set a getter for internal) – sparksen Jul 25 '17 at 22:06
  • The `Project` class is written in such a way that it's only possible to get the `name` and whether or not it is `internal`. (This is true both for using it in a `TableView` and also for using it anywhere else in your application.) So those are the only values it's possible to represent in the table. You could create a column that displayed whether or not it is internal (and you can represent that information any way you want), but not its type in general. – James_D Jul 25 '17 at 22:09

0 Answers0