简体   繁体   中英

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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