Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 GWT 2.4。我有一个 FormPanel 的引用,它包含一个 id="save" 的按钮。在给定表单面板实例的情况下,如何获取对 Button 小部件的引用?
请注意,Button 不是 formPanel 的直接后代,因此“formPanel.getWidget()”不会自动返回对 Button 的引用。
谢谢, -
您可以使用
formPanel.getWidget(),
formPanel.getWidget()
如果您正在使用com.google.gwt.user.client.ui.FormPanel. 它将为您提供对您在 FormPanel 中添加的小部件的引用。
com.google.gwt.user.client.ui.FormPanel