1.问题描述
我在一篇教程里看到关于 GridBagConstraints 的ipadx和ipady的描述:
ipadx, ipady
Specifies the internal padding: how much to add to the minimum size of
the component. The default value is zero. The width of the component
will be at least its minimum width plus ipadx*2 pixels, since the
padding applies to both sides of the component. Similarly, the height
of the component will be at least its minimum height plus ipady*2 pixels.
我理解的大致意思是:
设置ipadx和ipady后得到最终的组件的大小应该是(组件最小宽度+(ipadx or ipady)*2)
举例:
假设 ipadx = 10; ipady = 10;
组件默认宽高是 30 * 40;
按上面的说法就是:最终组件大小是 (30+10*2)*(40+10*2)
出现的疑问
但是在我实际编写案例的时候得到的结果却是:(30+5*2)*(40+5*2)
也就是说,实际上是把ipadx
或者ipady
平均分配给的组件的上下左右
那么问题就是:是我理解错了还是教程本身在错误,亦或是有其它的理解?
原教程地址:
http://www.math.uni-hamburg.d...
里面有关于ipadx和ipady的描述
谢谢各位了