如何分配自动完成文本字段的JTable细胞? [英] How to assign the auto complete text field to JTable cell?

查看:230
本文介绍了如何分配自动完成文本字段的JTable细胞?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已创建了一个自动完成文本字段。

我想使用和尝试,包括我的的JTable 电池领域,但它不会显示

请指教


解决方案

(假设我理解这个问题)

您需要换你编辑器的TableCellEditor 。看看一个例子rel=\"nofollow\">。

一旦你有它设置,您需要注册与表编辑器。

的一种方式是通过 TableColumnModel的

<$p$p><$c$c>table.getColumnModel().getColumn(indexToColumnInQuestion).setCellEditor(tableCellAutoCompleteEditor);

I have created one Class for auto complete text fields.

I want to use that Class and try to include my JTable cell fields, but it won't display.

Please advice

解决方案

(Assuming I understand the question)

You need to wrap your editor in TableCellEditor. Have a look at Using Other Editors an example.

Once you have it set up, you need to register the editor with the table.

One way is to register the editor with the column in question via the TableColumnModel

table.getColumnModel().getColumn(indexToColumnInQuestion).setCellEditor(tableCellAutoCompleteEditor);

这篇关于如何分配自动完成文本字段的JTable细胞?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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