Browse Source

FRGUI布局适配RTL

persist/11.0-arabic
obo 4 months ago
parent
commit
68be187652
  1. 22
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java

22
designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java

@ -40,7 +40,7 @@ public class FRGUIPaneFactory {
* @return FlowLayout对象 * @return FlowLayout对象
*/ */
public static LayoutManager createBoxFlowLayout() { // createBoxFlowLayout 图表用到的比较多 public static LayoutManager createBoxFlowLayout() { // createBoxFlowLayout 图表用到的比较多
return new FlowLayout(FlowLayout.LEFT, 2, 0); return new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT, 2, 0);
} }
/** /**
@ -49,7 +49,7 @@ public class FRGUIPaneFactory {
* @return FlowLayout对象 * @return FlowLayout对象
*/ */
public static LayoutManager createLeftZeroLayout() { public static LayoutManager createLeftZeroLayout() {
return new FlowLayout(FlowLayout.LEFT, 0, 0); return new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT, 0, 0);
} }
/** /**
@ -77,7 +77,7 @@ public class FRGUIPaneFactory {
* @return FlowLayout对象 * @return FlowLayout对象
*/ */
public static LayoutManager createLabelFlowLayout() { // createLabelFlowLayout public static LayoutManager createLabelFlowLayout() { // createLabelFlowLayout
return new FlowLayout(FlowLayout.LEFT); // 默认 5, 5 return new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT); // 默认 5, 5
} }
/** /**
@ -86,7 +86,7 @@ public class FRGUIPaneFactory {
* @return FlowLayout对象 * @return FlowLayout对象
*/ */
public static LayoutManager createL_FlowLayout() { public static LayoutManager createL_FlowLayout() {
return new FlowLayout(FlowLayout.LEFT, 10, 10); return new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT, 10, 10);
} }
/** /**
@ -225,7 +225,7 @@ public class FRGUIPaneFactory {
JPanel jp = new JPanel(); JPanel jp = new JPanel();
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(string); UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(string);
jp.setBorder(explainBorder); jp.setBorder(explainBorder);
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); jp.setLayout(new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT, 0, 0));
return jp; return jp;
} }
@ -343,7 +343,7 @@ public class FRGUIPaneFactory {
public static JPanel createNormalFlowInnerContainer_M_Pane() { public static JPanel createNormalFlowInnerContainer_M_Pane() {
JPanel jp = new JPanel(); JPanel jp = new JPanel();
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); jp.setLayout(new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT));
return jp; return jp;
} }
@ -355,18 +355,18 @@ public class FRGUIPaneFactory {
public static JPanel createLeftFlowZeroGapBorderPane() { public static JPanel createLeftFlowZeroGapBorderPane() {
JPanel jp = new JPanel(); JPanel jp = new JPanel();
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); jp.setLayout(new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT, 0, 0));
return jp; return jp;
} }
/** /**
* 创建一个靠左流式布局正常流式内嵌 * 创建一个流式布局正常流式内嵌
* *
* @return JPanel对象 * @return JPanel对象
*/ */
public static JPanel createNormalFlowInnerContainer_S_Pane() { public static JPanel createNormalFlowInnerContainer_S_Pane() {
JPanel jp = new JPanel(); JPanel jp = new JPanel();
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); jp.setLayout(new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT));
return jp; return jp;
} }
@ -377,7 +377,7 @@ public class FRGUIPaneFactory {
*/ */
public static JPanel createBoxFlowInnerContainer_S_Pane() { public static JPanel createBoxFlowInnerContainer_S_Pane() {
JPanel jp = new JPanel(); JPanel jp = new JPanel();
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2)); jp.setLayout(new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT, 2, 2));
return jp; return jp;
} }
@ -416,7 +416,7 @@ public class FRGUIPaneFactory {
public static JPanel createBoxFlowInnerContainer_S_Pane(int hgap, int vgap) { public static JPanel createBoxFlowInnerContainer_S_Pane(int hgap, int vgap) {
JPanel jp = new JPanel(); JPanel jp = new JPanel();
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
jp.setLayout(new FlowLayout(FlowLayout.LEFT, hgap, vgap)); jp.setLayout(new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT, hgap, vgap));
return jp; return jp;
} }

Loading…
Cancel
Save