如何分配自动完成文本字段的JTable细胞?

编程入门 行业动态 更新时间:2024-10-17 23:25:51
本文介绍了如何分配自动完成文本字段的JTable细胞?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

请指教

解决方案

(假设我理解这个问题)

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

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

的一种方式是通过 TableColumnModel的

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细胞?

本文发布于:2023-11-24 22:54:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1627212.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字段   自动完成   细胞   分配   文本

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!