dimanche 12 avril 2020

JavaFX tableview add checkbox and mutiple rows

first. I want add checkbox to first column. second.I want to get DATA and mark it in multiple lines, but I don't know how to do it. columns are already define by Scene Builder.

this is my code.... plz help guys!

ObservableList<Person> data = FXCollections.observableArrayList(
                    new Person("", testmsg[0], testmsg[1], testmsg[2], testmsg[3], testmsg[4], testmsg[5], testmsg[6],
                            testmsg[7], testmsg[8], testmsg[9]));

            remark.setCellValueFactory(cellData -> cellData.getValue().remarkProperty());
            Purchplan.setCellValueFactory(cellData -> cellData.getValue().PurchplanProperty());
            Producplan.setCellValueFactory(cellData -> cellData.getValue().ProducplanProperty());
            RPID.setCellValueFactory(cellData -> cellData.getValue().RPIDProperty());
            itemname.setCellValueFactory(cellData -> cellData.getValue().itemnameProperty());
            RPamount.setCellValueFactory(cellData -> cellData.getValue().RPamountProperty());
            RPdate.setCellValueFactory(cellData -> cellData.getValue().RPdateProperty());
            RPlocation.setCellValueFactory(cellData -> CellData.getValue().RPlocationProperty());
            RPperson.setCellValueFactory(cellData -> cellData.getValue().RPpersonProperty());
            buyer.setCellValueFactory(cellData -> cellData.getValue().buyerProperty());
            condition.setCellValueFactory(cellData -> cellData.getValue().conditionProperty());

            RPTableview.setItems(data);

and this is class

public class Person {
    public SimpleStringProperty purchplan;
    public SimpleStringProperty Producplan;
    public SimpleStringProperty RPID;
    public SimpleStringProperty itemname;
    public SimpleStringProperty RPamount;
    public SimpleStringProperty RPdate;
    public SimpleStringProperty RPlocation;
    public SimpleStringProperty RPperson;
    public SimpleStringProperty buyer;
    public SimpleStringProperty condition;
    public SimpleBooleanProperty remark;

    public Person(boolean checked,String purchplan, String producplan, String RPID, String itemname, String RPamount, String RPdate,
            String RPlocation, String RPperson, String buyer, String condition) {
        this.remark = new SimpleBooleanProperty(checked);
        this.purchplan = new SimpleStringProperty(purchplan);
        this.Producplan = new SimpleStringProperty(producplan);
        this.RPID = new SimpleStringProperty(RPID);
        this.itemname = new SimpleStringProperty(itemname);
        this.RPamount = new SimpleStringProperty(RPamount);
        this.RPdate = new SimpleStringProperty(RPdate);
        this.RPlocation = new SimpleStringProperty(RPlocation);
        this.RPperson = new SimpleStringProperty(RPperson);
        this.buyer = new SimpleStringProperty(buyer);
        this.condition = new SimpleStringProperty(condition);
    }

    public BooleanProperty remarkProperty() {
        return remark;
    }
    public StringProperty PurchplanProperty() {
        return purchplan;
    }
    }
'
'
'
'



Aucun commentaire:

Enregistrer un commentaire