The code below are instance methods of an object.
private StringProperty buySell;
// getters
public String getBuySell(){
return this.buySell.get();
}
// return Property Object
public StringProperty buySellProperty(){
return this.buySell;
}
// setters
public void setBuySell(String buySell){
this.buySell.set(buySell);
}
In my Controller
class, I have created a TableColumn
for buySell
string property with the code below.
When I created a transaction, there will be a new row on the tableView
. However, I want to be able to edit the buySell tableCell.
Question: How can I embed a choicebox
with values buy
, sell
within the setOnEdit
function such that when I double click on the cell, it will give me a choicebox ?
I have my choicebox
code below but I have no idea how to combine these things together.
ChoiceBox<BuySell> buySellBox = new ChoiceBox<>();
buySellBox.getItems().addAll("Buy", "Sell");
Update: Problem is still unresolved. However, by following the answer in this post, this is what I have got so far. After creating an object, a table row is created but when I click onto the table cell Buy
to edit, nothing happens (I was expecting a drop down choice box to appear and let me re-select my choice).
My table is editable, since I am able to edit tableCell using Volume
using the code above.
Added in the images below to show that I am able to edit the Volume
tableCell , but not the buySell
tableCell, whenever I click on it.