“编辑”中的 Java Swing JTable 单元格模式使用不同的设置集?

发布于 2024-08-19 03:19:01 字数 562 浏览 1 评论 0原文

我已经为 JTable 设置了一些参数,但似乎它们仅在我所说的“查看”模式下有效。编辑单元格内容时,没有任何效果。

在下面的屏幕截图中,您可以看到字体大小如何恢复为默认值。 (大的是我设定的,也是我想看到的)。

另外,我将默认区域设置设置为德国,以便我的十进制数字将使用逗号,如 12,24(而不是美国 12.24 样式) - 一旦我尝试编辑单元格,它也会停止工作。它恢复为美国点样式,在我按 Enter 键后,它再次以逗号显示。例如,如果我输入 12,24 单元格不接受它作为无效双精度。但是当我输入 12.24 后,按 Enter 键后,它显示为 12,24 - 正确的德国风格:)

简而言之,它看起来像单元格编辑模式使用了一组不同的设置...我该如何更改或者,最好使其使用与非编辑模式相同的方式?

单元格行为 http://img96.imageshack.us/img96/9118/jtablebehavior.png< /a>

I have set some parameters for my JTable, but it seems they are in effect only in what I call "view" mode. When editing cell content, nothing works.

In the screenshot below you can see how the font size reverted back to default. (Large one is what I set and what I want to see).

Also, I have default Locale set to Germany so that my decimal numbers would use commas as in 12,24 (instead of US 12.24 style) - which also stops working as soon as I try editing cell. It reverts back to US dot style, and after I hit Enter it gets displayed with comma again. E.g. if I enter 12,24 cell does not accept it as invalid double. But when I enter 12.24, after I hit Enter, it is displayed as 12,24 - proper German style :)

So in short it looks like cell-in-editing-mode uses a different set of settings... how can I change those or, preferably, make it use the same as in non-editing mode?

cell behavior http://img96.imageshack.us/img96/9118/jtablebehavior.png

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

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

发布评论

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

评论(1

三生池水覆流年 2024-08-26 03:19:01

您可以在组件本身上设置区域设置,如此处。为了更好地控制,您可以定义自己的单元格编辑器,如 教程。除了那里的示例之外,这里还有一个完整的编辑器/渲染器示例

You can set the locale on the component itself, as shown here. For better control you can define your own cell editor, as discussed in this tutorial. In addition to the examples there, here is a complete editor/renderer example.

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