且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

动态向JPanel添加组件

更新时间:2023-12-05 08:51:16

调用嵌套布局中所示,在父容器上为%28%29"rel =" nofollow noreferrer> validate() 例子.左下方的那些标签是动态添加的.请注意,调用pack()可能会导致GUI的大小发生变化,而调用validate()不会.如果需要以调整GUI的大小,请调用pack(),否则调用validate().

Call validate() on the parent container, as shown in the Nested Layout Example. Those labels on the lower left are added dynamically. Note that calling pack() might cause the size of the GUI to change, whereas calling validate() won't. If you need to get the GUI to resize - call pack(), else call validate().