简体   繁体   English

在编辑时,将JTable单元格中的值从右到左对齐

[英]Align values in JTable cells to right-to-left while Editing

I have the following table 我有下表 在此处输入图片说明

I found This code to align values in "كوردى" column to Right-To-Left. 我发现代码可以将“كوردى”列中的值与从右到左对齐。
It works fine, But when i edit cells the align becomes Left-To-Right as shown at the above Image, 它可以正常工作,但是当我编辑单元格时,如上图所示,对齐将变为从左到右,
What i do to align values to Right-To-Left while editing ? 我在编辑时如何将值从右向左对齐?

I found the my answer, Thanks for all 我找到了我的答案,谢谢大家

 JTextField textField = new JTextField();
 textField.setBorder(new LineBorder(Color.BLACK));
 DefaultCellEditor dce = new DefaultCellEditor( textField );
 table.getColumnModel().getColumn(2).setCellEditor(dce);
 textField.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM