[英]Efficient way to add Components to Java Swing panel
I have a pre-constructed java panel that has about 30000 labels already added to it. 我有一个预先构造的Java面板,其中已经添加了大约30000个标签。 I need to efficiently add this to a scrollpane on my Jframe.
我需要将其有效地添加到Jframe的滚动窗格中。 However if I call the add method it can take about 30 seconds to add to the scrollpane.
但是,如果我调用add方法,则可能需要30秒钟才能将其添加到滚动窗格中。 Is there another way I can do this more efficiently?
我还有另一种方法可以更有效地做到这一点吗? I need the UI to update quickly and if I re-add the labels to the panel everytime I need to display them I think this will be more expensive than simply loading the already rendered panel.
我需要UI快速更新,并且如果每次显示标签时都将标签重新添加到面板中,我认为这比简单地加载已渲染的面板要贵得多。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.