简体   繁体   中英

How do I get a button to align to the right in MigLayout

I am adding a button to a panel using Miglayout, and try what I might, I cannot get it to go to the right end of the panel. It insists on going flush left. Oddly, the demo is kind of short on such on a example (it only shows it in the context of other buttons on the same panel.

I have a panel like this:

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

Except that it always insists on putting it like this:

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

OK, I got the answer to this (finally). When adding the panel that contains the button add the component constraint of "gapbefore push." I had been trying that, but only on the button itself, not the panel.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM