|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.fr.base.i18n; |
|
|
|
|
|
|
|
|
|
import javax.swing.border.TitledBorder; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.ComponentOrientation; |
|
|
|
|
import java.awt.Container; |
|
|
|
@ -15,7 +16,10 @@ import java.util.Locale;
|
|
|
|
|
public class BidiUtils { |
|
|
|
|
|
|
|
|
|
//private static final Locale ar = new Locale("ar", "SA");
|
|
|
|
|
private static final Locale ar = Locale.CHINA; |
|
|
|
|
private static final Locale ar = true ? new Locale("ar", "SA") : Locale.CHINA; |
|
|
|
|
//private static final Locale ar = Locale.CHINA;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private BidiUtils() { |
|
|
|
|
} |
|
|
|
@ -34,6 +38,12 @@ public class BidiUtils {
|
|
|
|
|
return component; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void setOrientationByLocale(Component... components) { |
|
|
|
|
for (Component component : components) { |
|
|
|
|
component.setComponentOrientation(ComponentOrientation.getOrientation(ar)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void applyOrientationByLocale(Component... components) { |
|
|
|
|
for (Component component : components) { |
|
|
|
|
component.applyComponentOrientation(ComponentOrientation.getOrientation(ar)); |
|
|
|
@ -58,6 +68,11 @@ public class BidiUtils {
|
|
|
|
|
return result.toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static <T extends TitledBorder> T applyTitledBorderJustification(T titledBorder) { |
|
|
|
|
titledBorder.setTitleJustification(BidiUtils.rtl() ? TitledBorder.RIGHT : TitledBorder.LEFT); |
|
|
|
|
return titledBorder; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 镜像BoxLayout布局组件 |
|
|
|
|
*/ |
|
|
|
|