代码之家  ›  专栏  ›  技术社区  ›  Yishai

如何使按钮在布局中向右对齐

  •  2
  • Yishai  · 技术社区  · 15 年前

    我正在使用Miglayout将一个按钮添加到一个面板中,并尝试我所能做的,但我无法使它转到面板的右端。它坚持向左转。奇怪的是,这个演示在这样一个例子中有点简短(它只在同一个面板上的其他按钮的上下文中显示它)。

    我有一个这样的小组:

        dialog
          ->complex display retrieved from another class
                                                   OK Button here.
    

    但它总是坚持这样说:

        dialog
          ->complex display retrieved from another class
        OK Button here.
    
    2 回复  |  直到 12 年前
        1
  •  4
  •   Yishai    15 年前

    好吧,我终于找到答案了。在添加包含按钮的面板时,添加“gapbeforepush”的组件约束。我一直在尝试,但只在按钮本身上,而不是面板上。

        2
  •  1
  •   ndfkj asdkfh    12 年前

    panel.add(button, "skip(the amount of cells you have), al 100%")