#Disable column moving for TableView

1 messages · Page 1 of 1 (latest)

nimble rose
native tinselBOT
#

<@&987246487241105418> please have a look, thanks.

nimble rose
#

Nevermind there's a reorderable attribute for the columns that was really hard to find online for some reason

#

Which I also didn't think to try in the first place for some reason

#

Actually is it possible to define a TableView in FXML and programmically add items to it that display properly?

#

I add an item to it like this:

itemList = FXCollections.observableArrayList();
itemList.add(new TransactionItem("test", 1, 100.0));
items.setItems(itemList);```
#

But it shows as empty:

#

This is the code for TransactionItem:

import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;

public class TransactionItem
{
    private SimpleStringProperty name;
    private SimpleIntegerProperty amount;
    private SimpleDoubleProperty price;

    public TransactionItem(String n, int a, double p)
    {
        name = new SimpleStringProperty(n);
        amount = new SimpleIntegerProperty(a);
        price = new SimpleDoubleProperty(p);
    }

    public SimpleStringProperty getNameProperty() { return name; }
    public SimpleIntegerProperty getAmountProperty() { return amount; }
    public SimpleDoubleProperty getPriceProperty() { return price; }

    public String getName() { return name.get(); }
    public int getAmount() { return amount.get(); }
    public double getPrice() { return price.get(); }
}
nimble rose
#

The method this example uses for column text alignment doesn't seem to work anymore

#

Is there an up to date way to align column text?