问题
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.
回答1:
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.
回答2:
panel.add(button, "skip(the amount of cells you have), al 100%")
来源:https://stackoverflow.com/questions/3247497/how-do-i-get-a-button-to-align-to-the-right-in-miglayout