Java – in borderlayout Keep the size of JButton in center

Is there any way to keep the natural size of JButton in the center of borderlayout? Now, it expands in all directions to fill it, but I want it to be normal size

If this is not possible, how can I put the button in the center of the panel?

Solution

I suggest going directly to gridbaglayout Although it has some strange behavior and bad interface, it is a standard layout and can do almost anything You will need it, so you can always use the same layout manager, even if it is not very necessary

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>