Browse Source

hzzzzzzzzzz

master
hzzz 7 years ago
parent
commit
2150be4841
  1. 2
      designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java
  2. 10
      designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java
  3. 2
      designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java
  4. 2
      designer/src/com/fr/design/widget/ui/WritableRepeatEditorPane.java
  5. 1
      designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java
  6. 44
      designer_base/src/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java
  7. 926
      designer_base/src/com/fr/design/layout/FRGUIPaneFactory.java

2
designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java

@ -22,7 +22,7 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false); directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false);
directWriteCheckBox.setPreferredSize(new Dimension(100, 30)); directWriteCheckBox.setPreferredSize(new Dimension(100, 30));

10
designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java

@ -5,6 +5,9 @@ import com.fr.design.gui.frpane.TreeSettingPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.itree.refreshabletree.TreeRootPane; import com.fr.design.gui.itree.refreshabletree.TreeRootPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.FRLeftFlowLayout;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.TreeEditor; import com.fr.form.ui.TreeEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -46,13 +49,14 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane<TreeEditor> {
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
return this.setSecondContentPane(); return this.setSecondContentPane();
} }
protected JPanel setSecondContentPane() { protected JPanel setSecondContentPane() {
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0();
contentPane.add(contenter,BorderLayout.NORTH); contentPane.add(contenter,BorderLayout.NORTH);
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("Form-Remove_Repeat_Data"), false); removeRepeatCheckBox = new UICheckBox(Inter.getLocText("Form-Remove_Repeat_Data"), false);
contenter.add(removeRepeatCheckBox); contenter.add(removeRepeatCheckBox);

2
designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java

@ -39,7 +39,7 @@ public class WaterMarkDictPane extends JPanel {
int[][] rowCount = {{1, 1}}; int[][] rowCount = {{1, 1}};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
// JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); // JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
} }

2
designer/src/com/fr/design/widget/ui/WritableRepeatEditorPane.java

@ -15,7 +15,7 @@ public abstract class WritableRepeatEditorPane<E extends WriteAbleRepeatEditor>
@Override @Override
protected JPanel setSecondContentPane() { protected JPanel setSecondContentPane() {
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel otherContentPane = this.setThirdContentPane(); JPanel otherContentPane = this.setThirdContentPane();
if (otherContentPane != null) { if (otherContentPane != null) {

1
designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java

@ -52,6 +52,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
private void initComponents(boolean isEditor) { private void initComponents(boolean isEditor) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel buildWayPanel= FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); JPanel buildWayPanel= FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
buildWayPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
UILabel buildWayLabel = new UILabel(Inter.getLocText("FR-Designer_Build-Way") + " :"); UILabel buildWayLabel = new UILabel(Inter.getLocText("FR-Designer_Build-Way") + " :");
buildWayPanel.add(buildWayLabel); buildWayPanel.add(buildWayLabel);
buildBox = new UIComboBox(buildWay); buildBox = new UIComboBox(buildWay);

44
designer_base/src/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java

@ -9,7 +9,6 @@ import javax.swing.JPanel;
import com.fr.data.impl.TreeAttr; import com.fr.data.impl.TreeAttr;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -18,10 +17,10 @@ public class TreeRootPane extends BasicPane {
// 是否支持多选(checkBoxTree) // 是否支持多选(checkBoxTree)
//private JCheckBox multipleSelection; //private JCheckBox multipleSelection;
private UIComboBox checkTypeComboBox; private UICheckBox checkTypeCheckBox;
// richer:加载的方式,支持异步加载和完全加载 // richer:加载的方式,支持异步加载和完全加载
private UIComboBox loadTypeComboBox; private UICheckBox loadTypeCheckBox;
private UICheckBox layerTypeCheckBox; private UICheckBox layerTypeCheckBox;
@ -30,31 +29,26 @@ public class TreeRootPane extends BasicPane {
public TreeRootPane() { public TreeRootPane() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
JPanel checkTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel checkTypePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0();
checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
checkTypePane.add(new UILabel(Inter.getLocText("Tree-Mutiple_Selection_Or_Not") + ":")); checkTypeCheckBox = new UICheckBox(Inter.getLocText("Tree-Mutiple_Selection_Or_Not"));
checkTypeComboBox = new UIComboBox(new String[] {Inter.getLocText("Yes"), Inter.getLocText("No")}); checkTypePane.add(checkTypeCheckBox);
checkTypePane.add(checkTypeComboBox);
this.add(checkTypePane); this.add(checkTypePane);
JPanel loadTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel loadTypePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0();
loadTypePane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
loadTypePane.add(new UILabel(Inter.getLocText("Widget-Load_Type") + ":")); loadTypeCheckBox = new UICheckBox(Inter.getLocText("Widget-Load_By_Async"));
loadTypeComboBox = new UIComboBox(new String[]{Inter.getLocText("Widget-Load_By_Async"), Inter.getLocText("Widget-Load_By_Complete")}); loadTypePane.add(loadTypeCheckBox);
loadTypePane.add(loadTypeComboBox);
this.add(loadTypePane); this.add(loadTypePane);
JPanel leafSelectPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel leafSelectPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0();
leafSelectPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
leafSelectPane.add(layerTypeCheckBox = new UICheckBox(Inter.getLocText("Tree-Select_Leaf_Only"))); leafSelectPane.add(layerTypeCheckBox = new UICheckBox(Inter.getLocText("Tree-Select_Leaf_Only")));
UILabel tips = new UILabel(Inter.getLocText("Tree-Select_Leaf_Only_Tips"));
tips.setForeground(new Color(147, 178, 233));
leafSelectPane.add(tips);
this.add(leafSelectPane); this.add(leafSelectPane);
JPanel returnFullPathPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel returnFullPathPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0();
returnFullPathPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
returnFullPathPane.add(returnFullPathCheckBox = new UICheckBox(Inter.getLocText("Tree-Return_Full_Path"))); returnFullPathPane.add(returnFullPathCheckBox = new UICheckBox(Inter.getLocText("Tree-Return_Full_Path")));
this.add(returnFullPathPane); this.add(returnFullPathPane);
} }
@ -65,16 +59,16 @@ public class TreeRootPane extends BasicPane {
} }
public void populate(TreeAttr treeAttr) { public void populate(TreeAttr treeAttr) {
checkTypeComboBox.setSelectedIndex(treeAttr.isMultipleSelection() ? 0 : 1); checkTypeCheckBox.setSelected(treeAttr.isMultipleSelection());
loadTypeComboBox.setSelectedIndex(treeAttr.isAjax() ? 0 : 1); loadTypeCheckBox.setSelected(treeAttr.isAjax());
layerTypeCheckBox.setSelected(treeAttr.isSelectLeafOnly()); layerTypeCheckBox.setSelected(treeAttr.isSelectLeafOnly());
returnFullPathCheckBox.setSelected(treeAttr.isReturnFullPath()); returnFullPathCheckBox.setSelected(treeAttr.isReturnFullPath());
} }
public TreeAttr update() { public TreeAttr update() {
TreeAttr treeAttr = new TreeAttr(); TreeAttr treeAttr = new TreeAttr();
treeAttr.setMultipleSelection(checkTypeComboBox.getSelectedIndex() == 0); treeAttr.setMultipleSelection(checkTypeCheckBox.isSelected());
treeAttr.setAjax(loadTypeComboBox.getSelectedIndex() == 0); treeAttr.setAjax(loadTypeCheckBox.isSelected());
treeAttr.setSelectLeafOnly(layerTypeCheckBox.isSelected()); treeAttr.setSelectLeafOnly(layerTypeCheckBox.isSelected());
treeAttr.setReturnFullPath(returnFullPathCheckBox.isSelected()); treeAttr.setReturnFullPath(returnFullPathCheckBox.isSelected());

926
designer_base/src/com/fr/design/layout/FRGUIPaneFactory.java

@ -1,456 +1,510 @@
package com.fr.design.layout; package com.fr.design.layout;
import java.awt.BorderLayout; import com.fr.design.border.UITitledBorder;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.LayoutManager;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.Icon;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import com.fr.design.border.UITitledBorder; import javax.swing.*;
import java.awt.*;
public class FRGUIPaneFactory { public class FRGUIPaneFactory {
private FRGUIPaneFactory() { private FRGUIPaneFactory() {
} }
public static final float WIDTH_PARA_F = 80.0f; public static final float WIDTH_PARA_F = 80.0f;
public static final int WIDTH_OFFSET_N = 60; public static final int WIDTH_OFFSET_N = 60;
public static final int WIDTH_OFFSET_M = 20; public static final int WIDTH_OFFSET_M = 20;
public static final int WIDTH_PARA_INT = 80; public static final int WIDTH_PARA_INT = 80;
public static final float WIDTHABS_PARA_F = 2.0f; public static final float WIDTHABS_PARA_F = 2.0f;
public static final int HEIGHT_PARA = 25; public static final int HEIGHT_PARA = 25;
public static final int HEIGHT_OFFSET = 50; public static final int HEIGHT_OFFSET = 50;
/** /**
* 创建一个靠右靠左的水平间隙为2的流式布局 * 创建一个靠右靠左的水平间隙为2的流式布局
*
* @return FlowLayout对象 * @return FlowLayout对象
*/ */
public static LayoutManager createBoxFlowLayout() { // createBoxFlowLayout 图表用到的比较多 public static LayoutManager createBoxFlowLayout() { // createBoxFlowLayout 图表用到的比较多
return new FlowLayout(FlowLayout.LEFT, 2, 0); return new FlowLayout(FlowLayout.LEFT, 2, 0);
} }
/** /**
* 创建一个靠左的布局 * 创建一个靠左的布局
* @return FlowLayout对象 *
*/ * @return FlowLayout对象
public static LayoutManager createLeftZeroLayout() { */
return new FlowLayout(FlowLayout.LEFT, 0, 0); public static LayoutManager createLeftZeroLayout() {
} return new FlowLayout(FlowLayout.LEFT, 0, 0);
}
/** /**
* 创建一个靠左的水平和垂直间隙均为5的流式布局 * 创建一个靠左的水平和垂直间隙均为5的流式布局
*
* @return FlowLayout对象
*/
public static LayoutManager createLabelFlowLayout() { // createLabelFlowLayout
return new FlowLayout(FlowLayout.LEFT); // 默认 5, 5
}
/**
* 创建一个靠左流式布局间距10,10
*
* @return FlowLayout对象
*/
public static LayoutManager createL_FlowLayout() {
return new FlowLayout(FlowLayout.LEFT, 10, 10);
}
/**
* 创建一个居中流式布局
*
* @return FlowLayout对象
*/
public static LayoutManager createCenterFlowLayout() {
return new FlowLayout(FlowLayout.CENTER);
}
/**
* 创建一个靠右流式布局
*
* @return FlowLayout对象 * @return FlowLayout对象
*/ */
public static LayoutManager createLabelFlowLayout() { // createLabelFlowLayout public static LayoutManager createRightFlowLayout() {
return new FlowLayout(FlowLayout.LEFT); // 默认 5, 5 return new FlowLayout(FlowLayout.RIGHT);
} }
/** /**
* 创建一个靠左流式布局间距10,10 * 创建一个边框布局
* @return FlowLayout对象 *
*/ * @return BorderLayout对象
public static LayoutManager createL_FlowLayout() { */
return new FlowLayout(FlowLayout.LEFT, 10, 10); public static LayoutManager createBorderLayout() {
} return new BorderLayout();
}
/**
* 创建一个居中流式布局 /**
* @return FlowLayout对象 * 创建一个边框布局间距4,4
*/ *
public static LayoutManager createCenterFlowLayout() { * @return BorderLayout对象
return new FlowLayout(FlowLayout.CENTER); */
} public static LayoutManager createM_BorderLayout() {
return new BorderLayout(4, 4);
/** }
* 创建一个靠右流式布局
* @return FlowLayout对象 // TODO 删掉
*/
public static LayoutManager createRightFlowLayout() { /**
return new FlowLayout(FlowLayout.RIGHT); * 创建一个1列的网格布局
} *
* @return FRGridLayout对象
/** */
* 创建一个边框布局 public static LayoutManager create1ColumnGridLayout() {
* @return BorderLayout对象 return new FRGridLayout(1);
*/ }
public static LayoutManager createBorderLayout() {
return new BorderLayout(); /**
} * 创建一个2列的网格布局
*
/** * @return FRGridLayout对象
* 创建一个边框布局间距4,4 */
* @return BorderLayout对象 public static LayoutManager create2ColumnGridLayout() {
*/ return new FRGridLayout(2);
public static LayoutManager createM_BorderLayout() { }
return new BorderLayout(4,4);
} /**
* 创建一个n列的网格布局
// TODO 删掉 *
* @param nColumn 列数
/** * @return FRGridLayout对象
* 创建一个1列的网格布局 */
* @return FRGridLayout对象 public static LayoutManager createNColumnGridLayout(int nColumn) {
*/ return new FRGridLayout(nColumn);
public static LayoutManager create1ColumnGridLayout() { }
return new FRGridLayout(1);
} /**
* 创建一个带标题边框面板
/** *
* 创建一个2列的网格布局 * @param string 边框标题
* @return FRGridLayout对象 * @return JPanel对象
*/ */
public static LayoutManager create2ColumnGridLayout() { public static JPanel createTitledBorderPane(String string) {
return new FRGridLayout(2); JPanel jp = new JPanel();
} UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(string);
jp.setBorder(explainBorder);
/** jp.setLayout(new FlowLayout(FlowLayout.LEFT));
* 创建一个n列的网格布局 return jp;
* @param nColumn 列数 }
* @return FRGridLayout对象
*/ /**
public static LayoutManager createNColumnGridLayout(int nColumn) { * 创建一个带标题边框面板并且居中显示
return new FRGridLayout(nColumn); *
} * @param borderTitle 边框标题
* @return JPanel对象
/** */
* 创建一个带标题边框面板 public static JPanel createTitledBorderPaneCenter(String borderTitle) {
* @param string 边框标题 JPanel jp = new JPanel();
* @return JPanel对象 UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(borderTitle);
*/ jp.setBorder(explainBorder);
public static JPanel createTitledBorderPane(String string) { jp.setLayout(new FlowLayout(FlowLayout.CENTER));
JPanel jp = new JPanel(); return jp;
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(string); }
jp.setBorder(explainBorder);
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); /**
return jp; * 创建一个靠左空边框布局间隔大
} *
* @return JPanel对象
/** */
* 创建一个带标题边框面板并且居中显示 public static JPanel createBigHGapFlowInnerContainer_M_Pane() {
* @param borderTitle 边框标题 JPanel jp = new JPanel();
* @return JPanel对象 jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
*/ jp.setLayout(new FRLeftFlowLayout(5, 60, 5));
public static JPanel createTitledBorderPaneCenter(String borderTitle) { return jp;
JPanel jp = new JPanel(); }
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(borderTitle);
jp.setBorder(explainBorder); /**
jp.setLayout(new FlowLayout(FlowLayout.CENTER)); * 创建一个靠左空边框面板间隔中等
return jp; *
} * @return JPanel对象
*/
/** public static JPanel createMediumHGapFlowInnerContainer_M_Pane() {
* 创建一个靠左空边框布局间隔大 JPanel jp = new JPanel();
* @return JPanel对象 jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
*/ jp.setLayout(new FRLeftFlowLayout(5, 20, 5));
public static JPanel createBigHGapFlowInnerContainer_M_Pane() { return jp;
JPanel jp = new JPanel(); }
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
jp.setLayout(new FRLeftFlowLayout(5, 60, 5)); /**
return jp; * 创建一个靠左空边框面板间隔中等firsthgap 为0
} *
* @return JPanel对象
/** */
* 创建一个靠左空边框面板间隔中等 public static JPanel createMediumHGapFlowInnerContainer_M_Pane_First0() {
* @return JPanel对象 JPanel jp = new JPanel();
*/ jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
public static JPanel createMediumHGapFlowInnerContainer_M_Pane() { jp.setLayout(new FRLeftFlowLayout(0, 20, 5));
JPanel jp = new JPanel(); return jp;
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); }
jp.setLayout(new FRLeftFlowLayout(5, 20, 5));
return jp; /**
} * 创建一个靠左空边框面板间隔中等
*
/** * @return JPanel对象
* 创建一个靠左空边框面板间隔中等 */
* @return JPanel对象 public static JPanel createMediumHGapHighTopFlowInnerContainer_M_Pane() {
*/ JPanel jp = new JPanel();
public static JPanel createMediumHGapHighTopFlowInnerContainer_M_Pane() { jp.setBorder(BorderFactory.createEmptyBorder(50, 5, 0, 0));
JPanel jp = new JPanel(); jp.setLayout(new FRLeftFlowLayout(5, 20, 5));
jp.setBorder(BorderFactory.createEmptyBorder(50, 5, 0, 0)); return jp;
jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); }
return jp;
} /**
* 创建一个正常靠左空边框面板
/** *
* 创建一个正常靠左空边框面板 * @return JPanel对象
* @return JPanel对象 */
*/ 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(FlowLayout.LEFT)); return jp;
return jp; }
}
/**
/** * 创建一个靠左0间距边框面板
* 创建一个靠左0间距边框面板 *
* @return JPanel对象 * @return JPanel对象
*/ */
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(FlowLayout.LEFT, 0, 0));
return jp; return jp;
} }
/** /**
* 创建一个靠左流式布局正常流式内嵌 * 创建一个靠左流式布局正常流式内嵌
* @return JPanel对象 *
*/ * @return JPanel对象
public static JPanel createNormalFlowInnerContainer_S_Pane() { */
JPanel jp = new JPanel(); public static JPanel createNormalFlowInnerContainer_S_Pane() {
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); JPanel jp = new JPanel();
return jp; jp.setLayout(new FlowLayout(FlowLayout.LEFT));
} return jp;
}
/**
* 创建一个靠左流式布局流式内嵌 /**
* @return JPanel对象 * 创建一个靠左流式布局流式内嵌
*/ *
public static JPanel createBoxFlowInnerContainer_S_Pane() { * @return JPanel对象
JPanel jp = new JPanel(); */
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2)); public static JPanel createBoxFlowInnerContainer_S_Pane() {
return jp; JPanel jp = new JPanel();
} jp.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2));
return jp;
/** }
* 创建一个靠右面板
* @return JPanel对象 /**
*/ * 创建一个靠左流式布局流式内嵌首元素距离左边0
public static JPanel createRightFlowInnerContainer_S_Pane() { *
JPanel jp = new JPanel(); * @return JPanel对象
jp.setLayout(new FlowLayout(FlowLayout.RIGHT)); */
return jp; public static JPanel createBoxFlowInnerContainer_S_Pane_First0() {
} JPanel jp = new JPanel();
jp.setLayout(new FRLeftFlowLayout(0, 0, 5));
/** return jp;
* 创建一个居中面板 }
* @return JPanel对象
*/ /**
public static JPanel createCenterFlowInnerContainer_S_Pane() { * 创建一个靠右面板
JPanel jp = new JPanel(); *
jp.setLayout(new FlowLayout(FlowLayout.CENTER)); * @return JPanel对象
return jp; */
} public static JPanel createRightFlowInnerContainer_S_Pane() {
JPanel jp = new JPanel();
/** jp.setLayout(new FlowLayout(FlowLayout.RIGHT));
* 创建一个居中0间距面板 return jp;
* @return JPanel对象 }
*/
public static JPanel createCenterFlowZeroGapBorderPane() { /**
JPanel jp = new JPanel(); * 创建一个居中面板
jp.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); *
jp.setBorder(BorderFactory.createEmptyBorder()); * @return JPanel对象
return jp; */
} public static JPanel createCenterFlowInnerContainer_S_Pane() {
JPanel jp = new JPanel();
/** jp.setLayout(new FlowLayout(FlowLayout.CENTER));
* 创建纵向排列面板 return jp;
* @return JPanel对象 }
*/
public static JPanel createY_AXISBoxInnerContainer_L_Pane() { /**
JPanel jp = new JPanel(); * 创建一个居中0间距面板
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); *
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); * @return JPanel对象
return jp; */
} public static JPanel createCenterFlowZeroGapBorderPane() {
JPanel jp = new JPanel();
/** jp.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
* 创建纵向边框面板 jp.setBorder(BorderFactory.createEmptyBorder());
* @return JPanel对象 return jp;
*/ }
public static JPanel createYBoxEmptyBorderPane() {
JPanel jp = new JPanel(); /**
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); * 创建纵向排列面板
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); *
return jp; * @return JPanel对象
} */
public static JPanel createY_AXISBoxInnerContainer_L_Pane() {
/** JPanel jp = new JPanel();
* 创建横向面板 jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
* @return JPanel对象 jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
*/ return jp;
public static JPanel createX_AXISBoxInnerContainer_L_Pane() { }
JPanel jp = new JPanel();
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); /**
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); * 创建纵向边框面板
return jp; *
} * @return JPanel对象
*/
/** public static JPanel createYBoxEmptyBorderPane() {
* 创建纵向面板M JPanel jp = new JPanel();
* @return JPanel对象 jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
*/ jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
public static JPanel createY_AXISBoxInnerContainer_M_Pane() { return jp;
JPanel jp = new JPanel(); }
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); /**
return jp; * 创建横向面板
} *
* @return JPanel对象
/** */
* 创建横向内置boxlayout的面板 public static JPanel createX_AXISBoxInnerContainer_L_Pane() {
* @return JPanel对象 JPanel jp = new JPanel();
*/ jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
public static JPanel createX_AXISBoxInnerContainer_M_Pane() { jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS));
JPanel jp = new JPanel(); return jp;
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); }
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS));
return jp; /**
} * 创建纵向面板M
*
/** * @return JPanel对象
* 创建纵向内置boxlayout的面板 */
* @return JPanel对象 public static JPanel createY_AXISBoxInnerContainer_M_Pane() {
*/ JPanel jp = new JPanel();
public static JPanel createY_AXISBoxInnerContainer_S_Pane() { jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
JPanel jp = new JPanel(); jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); return jp;
return jp; }
}
/**
/** * 创建横向内置boxlayout的面板
* 创建横向内置boxlayout的面板 *
* @return JPanel对象 * @return JPanel对象
*/ */
public static JPanel createX_AXISBoxInnerContainer_S_Pane() { public static JPanel createX_AXISBoxInnerContainer_M_Pane() {
JPanel jp = new JPanel(); JPanel jp = new JPanel();
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
return jp; jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS));
} return jp;
}
/**
* 创建n列网格面板 /**
* @param nColumn 列数 * 创建纵向内置boxlayout的面板
* @return JPanel对象 *
*/ * @return JPanel对象
public static JPanel createNColumnGridInnerContainer_S_Pane(int nColumn) { */
JPanel jp = new JPanel(); public static JPanel createY_AXISBoxInnerContainer_S_Pane() {
jp.setLayout(new FRGridLayout(nColumn)); JPanel jp = new JPanel();
return jp; jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
} return jp;
}
/**
* 创建n列网格面板 /**
* @param nColumn 列数 * 创建横向内置boxlayout的面板
* @param h 水平间距 *
* @param v 垂直间距 * @return JPanel对象
* @return JPanel对象 */
*/ public static JPanel createX_AXISBoxInnerContainer_S_Pane() {
public static JPanel createNColumnGridInnerContainer_Pane(int nColumn, int h, int v) { JPanel jp = new JPanel();
JPanel jp = new JPanel(); jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS));
jp.setLayout(new FRGridLayout(nColumn, h, v)); return jp;
return jp; }
}
/**
/** * 创建n列网格面板
* 创建顶格n列网格面板 *
* @param nColumn 列数 * @param nColumn 列数
* @return JPanel对象 * @return JPanel对象
*/ */
public static JPanel createFillColumnPane(int nColumn) { public static JPanel createNColumnGridInnerContainer_S_Pane(int nColumn) {
JPanel jp = new JPanel(); JPanel jp = new JPanel();
jp.setLayout(new FRGridLayout(nColumn, 0, 0)); jp.setLayout(new FRGridLayout(nColumn));
return jp; return jp;
} }
/** /**
* 创建边框面板L * 创建n列网格面板
* @return JPanel对象 *
*/ * @param nColumn 列数
public static JPanel createBorderLayout_L_Pane() { * @param h 水平间距
JPanel jp = new JPanel(); * @param v 垂直间距
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); * @return JPanel对象
jp.setLayout(FRGUIPaneFactory.createBorderLayout()); */
return jp; public static JPanel createNColumnGridInnerContainer_Pane(int nColumn, int h, int v) {
} JPanel jp = new JPanel();
jp.setLayout(new FRGridLayout(nColumn, h, v));
/** return jp;
* 创建边框面板M }
* @return JPanel对象
*/ /**
public static JPanel createBorderLayout_M_Pane() { * 创建顶格n列网格面板
JPanel jp = new JPanel(); *
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); * @param nColumn 列数
jp.setLayout(FRGUIPaneFactory.createM_BorderLayout()); * @return JPanel对象
return jp; */
} public static JPanel createFillColumnPane(int nColumn) {
JPanel jp = new JPanel();
/** jp.setLayout(new FRGridLayout(nColumn, 0, 0));
* 创建边框面板S return jp;
* @return JPanel对象 }
*/
public static JPanel createBorderLayout_S_Pane() { /**
JPanel jp = new JPanel(); * 创建边框面板L
jp.setLayout(FRGUIPaneFactory.createBorderLayout()); *
return jp; * @return JPanel对象
} */
public static JPanel createBorderLayout_L_Pane() {
/** JPanel jp = new JPanel();
* 创建卡片式布局 jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
* @return JPanel对象 jp.setLayout(FRGUIPaneFactory.createBorderLayout());
*/ return jp;
public static JPanel createCardLayout_S_Pane() { }
JPanel jp = new JPanel();
jp.setLayout(new CardLayout()); /**
return jp; * 创建边框面板M
} *
* @return JPanel对象
/** */
* 创建图标IconRadio面板 public static JPanel createBorderLayout_M_Pane() {
* @param icon 图标 JPanel jp = new JPanel();
* @param jradiobtn 按钮 jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
* @return JPanel对象 jp.setLayout(FRGUIPaneFactory.createM_BorderLayout());
*/ return jp;
public static JPanel createIconRadio_S_Pane(Icon icon, }
JRadioButton jradiobtn) {
jradiobtn.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); /**
jradiobtn.setBackground(new Color(255, 255, 255)); * 创建边框面板S
JPanel iconRadioPane = new JPanel(); *
iconRadioPane.setLayout(new BoxLayout(iconRadioPane, BoxLayout.X_AXIS)); * @return JPanel对象
*/
iconRadioPane.add(new UILabel(icon)); public static JPanel createBorderLayout_S_Pane() {
iconRadioPane.add(jradiobtn); JPanel jp = new JPanel();
jp.setLayout(FRGUIPaneFactory.createBorderLayout());
return iconRadioPane; return jp;
} }
/** /**
* 计算宽度 * 创建卡片式布局
* @param width 宽度输入值 *
* @return w 宽度输出值 * @return JPanel对象
*/ */
public static int caculateWidth(int width) { public static JPanel createCardLayout_S_Pane() {
int w = 0; JPanel jp = new JPanel();
float m = (width + WIDTH_OFFSET_M) / WIDTH_PARA_F; jp.setLayout(new CardLayout());
float n = (width + WIDTH_OFFSET_N) / WIDTH_PARA_F; return jp;
float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m); }
float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n);
float x = i > j ? i : j; /**
if (x == i) { * 创建图标IconRadio面板
w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M; *
} else if (x == j) { * @param icon 图标
w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N; * @param jradiobtn 按钮
} * @return JPanel对象
return w; */
} public static JPanel createIconRadio_S_Pane(Icon icon,
JRadioButton jradiobtn) {
/** jradiobtn.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
* 计算高度 jradiobtn.setBackground(new Color(255, 255, 255));
* @param height 高度输入值 JPanel iconRadioPane = new JPanel();
* @return 高度输出值 iconRadioPane.setLayout(new BoxLayout(iconRadioPane, BoxLayout.X_AXIS));
*/
public static int caculateHeight(int height) { iconRadioPane.add(new UILabel(icon));
int h = 0; iconRadioPane.add(jradiobtn);
float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA;
h = ((int) x + 1) * HEIGHT_PARA; return iconRadioPane;
return h; }
}
/**
* 计算宽度
*
* @param width 宽度输入值
* @return w 宽度输出值
*/
public static int caculateWidth(int width) {
int w = 0;
float m = (width + WIDTH_OFFSET_M) / WIDTH_PARA_F;
float n = (width + WIDTH_OFFSET_N) / WIDTH_PARA_F;
float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m);
float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n);
float x = i > j ? i : j;
if (x == i) {
w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M;
} else if (x == j) {
w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N;
}
return w;
}
/**
* 计算高度
*
* @param height 高度输入值
* @return 高度输出值
*/
public static int caculateHeight(int height) {
int h = 0;
float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA;
h = ((int) x + 1) * HEIGHT_PARA;
return h;
}
} }
Loading…
Cancel
Save