有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java将单元格合并到MigLayout?

如何使用MigLayout组合两个单元格

我有两个单元格,如下代码所示。我想把它们结合起来,我该怎么办

JPanel jPanelAccOil = new JPanel(new MigLayout("", "0[]0", "0[]0"));
jPanelAccOil.add(new JPanelInAI(null, "",
    sistema.getGestorComunicacioOPC().getParametresOPCHyperG().getActuatorOilPressure()));
this.add(jPanelAccOil, "cell 2 3");

JPanel jPanelAccPneumatic = new JPanel(new MigLayout("", "0[]0", "0[]0"));
jPanelAccPneumatic.add(new JPanelInAI(null, "",
    sistema.getGestorComunicacioOPC().getParametresOPCHyperG().getAccPneumaticPressure()));
this.add(jPanelAccPneumatic, "cell 3 3, wrap");

共 (1) 个答案

  1. # 1 楼答案

    可以使用来跨越单元格:

    span 2 
    

    试试这个:

    JPanel jPanelAccPneumatic = new JPanel(new MigLayout("", "0[]0", "0[]0"));
    jPanelAccPneumatic.add(new JPanelInAI(null, "",
        sistema.getGestorComunicacioOPC().getParametresOPCHyperG().getAccPneumaticPressure()));
    this.add(jPanelAccPneumatic, "cell 3 3, span 2, wrap");