gpt4 book ai didi

java - 如何在 GWT 中退出当前 View (onUnLoad)之前设置先前的值?

转载 作者:行者123 更新时间:2023-12-01 04:36:46 25 4
gpt4 key购买 nike

我已经在加载时存储了值,之后我更改了小部件属性,并且在卸载之前再次我想设置以前存储的值,我该怎么办?widget.addAttachHandler(EventHandler) 对我有帮助吗?

最佳答案

就这么简单design your own widget使用事件监听器。并在您的自定义小部件类中使用 ovveride 加载和卸载方法。

// This method is called when a widget is attached to the browser's document
@Override
protected void onLoad() {
setEventListener(inputElem, this);
// ...
}


// This method is called when a widget is detached from the browser's document
@Override protected void onUnload() {
// Clear out the inputElem's event listener (breaking the circular
// reference between it and the widget); avoid memory leaks
setEventListener(inputElem, null);
// ...
}

关于java - 如何在 GWT 中退出当前 View (onUnLoad)之前设置先前的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17232734/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com