Set JLabel Alignment from right to left

I have a JPanel that is divided into 2 blocks, in the south block (layout). I am adding JLabel. In the label, I want to insert a line with this rule: (Name, Date, Time, In/Out)

If my name was written in English, everything was in order, the problem arose when I wrote this name in some Unicode language such as Farsi, then alignment does not work properly. I apply 2 samples:

Right: enter image description here

Wrong: enter image description here

+4
source share
2 answers

You can create two different tags next to each other. One for the name and one for the rest. Thus, alignment of the name label will not affect the alignment of another label.

+3
source

Try using Component.setComponentOrientation () on the shortcut to force it left to right.

+1
source

All Articles