开发者

Get a button from a gridLayout

If I have elements inside my gridLayout, can I get the reference to that object, if yes, which function do I need to use? Is it good idea to perform so开发者_JS百科me actions on the objects inside gridLayout? Or there is another better language idiom?


No you cannot get references to items from a layout. However, you can from the container that holds the button. A better solution might be to hold a reference to the button at a higher level of scope in order to be able to access it later.


You can't get stuff out of a LayoutManager unless it specifically supports it, and GridLayout doesn't.

If you are putting Components into a Container then you probably have a reference to them anyway. Can't you pass this reference around?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜