Swing 表格中单元格编辑(单击或双击)的最佳实践 [英] Best Practice for Cell Editing (Single-Click or Double-Click) in Table in Swing

查看:48
本文介绍了Swing 表格中单元格编辑(单击或双击)的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一些关于编辑表格单元格的问题.

I want to ask some questions regarding editing cell in a table.

目前我在表格中进行单元格编辑的做法是通过双击单元格使单元格可编辑以进行文本输入.对于单击,它将改为选择行.它就像单元格编辑的 Excel 行为.我在一些 JIDE demo 中看到的,有些表格可以编辑使用单击,例如EditableTableHeaderDemo",其中一些可以使用双击进行编辑,例如 JideTableDemo.

Currently my practices of doing cell editing in a table is by double-clicking the cell to make the cell editable for text input. For the single-clicking, it will select the row instead. It just like Excel behaviour of cell editing. What I see in some of JIDE demo , some of the table can be editable using single-click such as "EditableTableHeaderDemo" and some of it can be editable using double-clicking such as JideTableDemo.

这里我想知道的是,无论是单击还是双击,表格中单元格编辑的最佳做法是什么?与单击编辑表格相比,如果我们使用双击编辑表格有什么问题吗?在用户友好性、可用性和人机交互方面,哪个更好?

What I want to know here is the best practices of cell editing in a table whether it is single-click or double-click? Is there any issue if we use double-click to edit the table compared to the single-click to edit the table? In terms of user friendliness,usability and human computer interaction, which one is better?

推荐答案

许多用户更喜欢键绑定.F2 是一个常见(但不通用)的默认值;Enter 也有一定的吸引力.还可以考虑在 java.util.Preferences 中选择部分,在此处提到.>

Many users prefer a key binding. F2 is a common (but not universal) default; Enter also has some appeal. Also consider making the choice part of your java.util.Preferences, mentioned here.

table.getInputMap().put(
    KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "startEditing");

这篇关于Swing 表格中单元格编辑(单击或双击)的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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