简体   繁体   English

在不按Enter或Tab键的情况下,如何获取表格单元格值为“ xyz”?

[英]How can I get table cell value as “xyz” WITHOUT hit the Enter or Tab key?

I found out if you editing a TableViewer cell without hit the Enter or Tab key. 我发现您是否在不按Enter或Tab键的情况下编辑TableViewer单元格。 Then the new cell value won't take effect. 这样,新的单元格值将不会生效。 For example, a table cell value is "abc" and you change it to "xyz". 例如,表单元格值为“ abc”,然后将其更改为“ xyz”。 Then when you read that table cell value, it still "abc". 然后,当您读取该表单元格值时,它仍为“ abc”。 You MUST hit the Enter or Tab key, then you will get that table cell value as "xyz". 您必须按下Enter或Tab键,然后您才能获得该表格单元格值“ xyz”。

How can I force that table cell value as "xyz" WITHOUT hit the Enter or Tab key? 如何在不按Enter或Tab键的情况下强制将表格单元格值设为“ xyz”?

Thanks very much in advance! 首先十分感谢!

i suggest you check the tableviewer api. 我建议您检查tableviewer api。 if it was a standard JTable you simply use this: 如果它是标准的JTable,则只需使用以下命令:

JTable table = new JTable(...);
table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

Temporally, i make a losing focus by set focus from current view to another view in RCP :). 暂时,我通过将焦点从当前视图设置为RCP中的另一个视图来失去焦点:)。 It's not official solution but effect. 这不是官方的解决方案,而是有效的解决方案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何让用户使用java中的扫描仪点击输入默认值? - How can I let a user hit enter for a default value using the Scanner in java? 如何使用ActionEvent获取ENTER键的KeyStroke? - How can I get the KeyStroke for an ENTER key using an ActionEvent? 如何在表中搜索值,然后在同一行上获取其他单元格值? - How can I search a value in a table and then get the other cell value on the same row? 除了单击鼠标外,如何使用Enter键点击提交? - How to hit submit using the Enter key besides the mouseclick? 按下Enter键后如何停止JDialog关闭? - How to stop JDialog from closing when you hit the Enter key? 我使用 FocusTraversalKeys() 使回车键像制表符一样工作,但是如果我想在回车键上对任何组件执行任何操作,那么该怎么做? - i make the enter key work like tab using FocusTraversalKeys() but if i want to perform any action on any component on enter key then how to do that? 使用JExcel API,如何在不添加隐藏的撇号的情况下输入未知数据类型的单元格值? - Using the JExcel API, how do I enter a cell value of unknown data type without a hidden apostrophe being added? 使用JFrame,如何获取Enter键以触发与按下按钮相同的结果? - Using JFrame, how can I get the enter key to trigger the same result as pressing the button? 如何从 excel 文件中获取特定的单元格值 - How can I get a specific cell value from an excel file MapReduce:如何在没有换行符的情况下输出键/值对? - MapReduce: How can I output key/value pair without newlines?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM