Set JLabel Alignment right-left
I have a JPanel that separated to 2 blocks, in south block (layout) I have add a JLabel, In the label I want to Insert a string with this rule: (Name, Date, Time, In/Out)
If my name was written in English everything was fine the problem appeared when I wrote the name in some Unicode language like Farsi, then the alignment not working as expected. I attach 2 sample:
Righ开发者_开发问答t one:
Wrong one:
You can create two different labels next to each other. One for the name and one for the remaining part. This way, the alignment of the name label won't affect the alignment of the other label.
Try using Component.setComponentOrientation() on the label to force it to left-to-right order.
精彩评论