从另一个组件中删除一个组件
这个小问题已经快把我逼疯了。我的主屏幕包含 2 个自定义组件;为了简单起见,我们将它们称为“A”和“B”。在组件 AI 中有一个按钮,我想用它来删除/替换组件 B。
为此,我调用主屏幕类中的组件 B 的引用。然后,我调用包含组件 B 的布局的 removeComponent(componentBReference) 方法。不幸的是,这绝对不会执行任何操作。我还在方法调用和replaceComponent()方法之后尝试了requestRepaint()。甚至 mainScreenReference.myLayout.setVisible(false) 也不起作用。
我做错了什么或者我必须考虑什么?
This little problem has been driving me insane. My main screen contains 2 custom components; let's call them "A" and "B" for the sake of simplicity. Within component A I have a button with which I would like to remove/replace component B.
To do this I am calling a reference of component B that I have in the main screen class. I then call the removeComponent(componentBReference) method of the layout which contains component B. Unfortunately this does absolutely nothing. I've also tried requestRepaint() after the method call and the replaceComponent() method. Not even mainScreenReference.myLayout.setVisible(false) works.
What am I doing wrong or what must I consider?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先尝试通过调用此方法 setImmediate(true) 为所有组件设置立即模式。
First of all try to set for all your components immediate mode by calling this method setImmediate(true).