JavaFX 2 TableView直接在控件上插入行 [英] JavaFX 2 TableView inserting rows directly on the control

查看:159
本文介绍了JavaFX 2 TableView直接在控件上插入行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JavaFX 2中的TableView控件是否允许在控件的单元格上插入新数据?

Does the TableView Control in JavaFX 2 allow the insertion of new data right on the cells of the control?

我一直无法在那个方向上找到任何东西.甚至Oracle示例在控件外部也有单独的文本框和ADD按钮(就像90年代初期一样-是的,我已经编程了很长时间...)

I have not been able to find anything in that direction. Even the Oracle sample has separate textboxes and an ADD button outside of the control (like it was in the early 90's - yea, I've been programming for that long...)

推荐答案

目前尚不清楚您要实现什么目标.

It's not really clear what do you want to achieve.

如果您要就地编辑表值,则可以看一下本教程:

If you mean editing table values in place you can take a look at this tutorial: http://docs.oracle.com/javafx/2.0/ui_controls/table-view.htm

如果要通过操作在单元格上添加新行,可以通过TableView.setContextMenu(context_menu);将上下文菜单添加到单元格,并实现在单元格右侧"添加新行.

If you want to add new row by action on cell you can add context menu to cells by TableView.setContextMenu(context_menu); and implement adding new row "right on the cells".

这篇关于JavaFX 2 TableView直接在控件上插入行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆