I m learning GWT and have started to get the hang of it. I m at the point where my code is getting to be a spaghetti mess so I m going back and factoring reasonable bits of it out as Composites. The first problem I ran into was that my tool support failed to give the new Composite class an initWidget() method. It did include a default constructor.
For the time being, I ve simply filled in my overridden initWidget()
method with a call to super(initWidget(w))
My project compiles and runs as expected, though I feel as though I must be missing something.
当重写init方法时,我应该注意什么,我需要在构造函数中放置什么。除此之外,还有什么需要知道的吗?还是只需要遵循普通的Java操作即可?
澄清 - 我意识到,根据您是想将所述 组合
类作为库的一部分发布还是仅作为您独立的应用的一部分发布,这个问题可能会有不同的答案。我个人目前没有开发外部有用组件的意图(主要是因为我在这个特定的技术上还不够熟练)。
谢谢!