java - Javafx select multiple rows -
i m trying select multiple rows in javafx dont want use keyboard (shift)for that.it should after click on selected , when click on other column should selected well.
i check other answers here couldnt find short , handy.is there shorter way ?
@fxml private static logger logger = logger.getlogger(mainframecontrol.class); public tableview<box> boxtable; protected final observablelist<box> boxdata = fxcollections.observablearraylist(); service service = new serviceimpl(); private stage mainstage; public mainframecontrol(stage mainstage) { fxmlloader fxmlloader = new fxmlloader(getclass().getresource("mainframe.fxml")); fxmlloader.setroot(this); fxmlloader.setcontroller(this); this.mainstage = mainstage; stage stage = new stage(); try { fxmlloader.load(); } catch (ioexception exception) { throw new runtimeexception(exception); } arraylist<box> list = service.findallboxen(); tablecolumn<box, string> boxnamecolumn = (tablecolumn<box, string>) boxtable.getcolumns().get(0); boxnamecolumn.setcellvaluefactory(new propertyvaluefactory<box, string>("boxname")); tablecolumn<box, string> sizecolumn = (tablecolumn<box, string>) boxtable.getcolumns().get(1); sizecolumn.setcellvaluefactory(new propertyvaluefactory<box, string>("size")); tablecolumn<box, string> windowcolumn = (tablecolumn<box, string>) boxtable.getcolumns().get(2); windowcolumn.setcellvaluefactory(new propertyvaluefactory<box, string>("window")); tablecolumn<box, string> costcolumn = (tablecolumn<box, string>) boxtable.getcolumns().get(3); costcolumn.setcellvaluefactory(new propertyvaluefactory<box, string>("cost")); tablecolumn<box, string> locationcolumn = (tablecolumn<box, string>) boxtable.getcolumns().get(4); locationcolumn.setcellvaluefactory(new propertyvaluefactory<box, string>("location")); tablecolumn<box, boolean> beddingcolumn = (tablecolumn<box, boolean>) boxtable.getcolumns().get(5); beddingcolumn.setcellvaluefactory(new propertyvaluefactory<box, boolean>("bedding")); boxtable.setitems(boxdata);
tableview.getselectionmodel().setselectionmode( selectionmode.multiple );
Comments
Post a Comment