Jtable 中使用多行增加单元格高度,但不使用滚动条

发布于 2024-08-05 17:56:43 字数 206 浏览 0 评论 0原文

海 我正在使用 Java 开发一个独立的应用程序,其中使用 JTable。问题是当我输入多行文本时,在我键入时整个文本不会显示在单元格中。当我键入多行文本时,我会看到滚动条.如何在打字时使整个文本可见。即如何在打字时增加 JTable 中的单元格宽度。但只有当我点击该单元格时才会显示整个文本。有人可以帮助我如何解决这个问题

谢谢 Chaithu

Hai
I am developing a standalone application using Java in which I am using a JTable.The problem is when I enter a multiline text,the entire text is not displayed in the cell while I am typing.I get a scroll when I type a multiline text.How can I get my whole text to be visible while I type.i.e How can I increase my Cell width in JTable while I am Typing. But the entire text will displayed only when I click out of that Cell.Can someone help me how to solve this problem

Thank You Chaithu

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

堇年纸鸢 2024-08-12 17:56:43

您应该尝试自定义 TableCellRenderer以 JTextArea 为例。对于输入,您可能需要类似的 TableCellEditor< /a>.

可以在 Java Specialists' Newsletter : Multi-line cells in JTable in JDK 1.4+< 中查看示例/a>.

You should try a custom TableCellRenderer with JTextArea for example. For typing you'll probably need similar TableCellEditor.

An example can be seen at Java Specialists' Newsletter : Multi-line cells in JTable in JDK 1.4+.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文