开发者

Creating Buttons Dynamically in Java

I want to create specified number of buttons dynamically, but the size of the buttons should match t开发者_如何学运维he window. Eg. First I am creating 10 buttons dynamically then it should create 10 buttons on the window. But in the time When I am specifying 5 buttons then it should create 5 buttons and it should match the window, that is according to the number of buttons the size of the button should adjust with the window size.


Which toolkit are you using? I'm going to assume you're using Swing or AWT.

In Swing and AWT, there is a thing called a layout manager that specifies how components are laid out. In this case, BoxLayout sounds perfect for what you're seeking to do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜