在包含阿拉伯字符的情况下,如何强制 JTable 不反转文本? [英] How to force JTable to NOT invert text in the case it contains arabic characters?

查看:13
本文介绍了在包含阿拉伯字符的情况下,如何强制 JTable 不反转文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下文字:

وزا.word

但是当在我的 JTable 上显示它时,它看起来像这样:

But when displaying it on my JTable it looks like this:

word.وزا

在每个 JLabel 或 TextArea 或任何其他输入中,它确实看起来像原始文本:

In every JLabel or TextArea or any other input it does look like the original text:

وزا.word

仅在 JTable 上我遇到了这样的问题.

ONLY on the JTable I am having such problem.

我不在乎它是否有意义,是的,我知道阿拉伯语是从右到左书写的.我的猜测是 Java 正在检测它并自动反转它,但我不希望它这样做.

I do not care if it is making sense or not, and yes I know the Arabic Language is written from right to left. My guess is Java is detecting it and automatically inverting it, but I do not want it to.

注意:我不知道 وزا 是什么意思,出于实际目的,我不在乎.对于这种情况,وزا.word 没有意义而 word.وزا 有意义,反之亦然,这也无关紧要.

Note: I have no idea what وزا means, and for practical purposes I don't care. It's also irrelevant for this case wether وزا.word does not make sense and word.وزا does or viceversa.

注意 2:文本,无论是否反转总是向左对齐(正如我所期望的那样).

Note 2: The text, reversed or not is always aligned to the left (as I expect it to).

提前致谢.

推荐答案

猜测,您的默认 Locale 是给 默认渲染器 与您的其他设置不一致的 ComponentOrientation.您可以尝试创建具有首选的 自定义渲染器使用此处建议的方法之一进行定位.

At a guess, your default Locale is giving the default renderer a ComponentOrientation that is inconsistent with your other settings. You might try creating a custom renderer having the preferred orientation using one of the approaches suggested here.

附录:java.text.Bidi 支持双向重新排序;您可以使用 unicode 格式控制代码点,如此 Q&A 中所建议.

Addendum: java.text.Bidi supports bidirectional reordering; you may be able to use unicode format control code points, as suggested in this Q&A.

这篇关于在包含阿拉伯字符的情况下,如何强制 JTable 不反转文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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