简体   繁体   中英

How to make each cell of table view Editable in JavaFx

I want to make each cell of Table View editable in JavaFx. I have seen a lot of examples on Internet but all of them requires to load data before. I want to create an empty table with with some specific number of rows and columns and there shouldn't be any data on those rows and columns and once the program will run, the user himself will enter the data in each cell of table View

You need to create a table with empty data set, and provide method to add data to table. I suggest you to create ad-hoc class with only data and use as model for table. To render editable cell box (textfield), in table, need to create a cell factory method. Can get some inspiration from my question about rendering a split menu button in table cell and the accepted answer JavaFX TableView custom cell rendering split menu button . To add row you can use an external button, or keyboard by intercepting keyevent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM