简体   繁体   English

添加空的JLabels是否昂贵?

[英]Is adding empty JLabels an expensive process?

I am trying to do something like below in Java, but and I have tried a BorderLayout so far (for the upper panel). 我正在尝试在Java中执行以下操作,但是到目前为止(在上面板中)我已经尝试过BorderLayout

在此处输入图片说明

The problem with that approach is that I cannot add in a "HELP" button. 这种方法的问题是我无法添加“帮助”按钮。 So, I am vying for the GridBagLayout . 因此,我正在争夺GridBagLayout The problem with that approach is that I might have to either add a bunch of empty JLabel s or just forget the whole upperPanel idea, and just add directly to the JFrame (which would be a cheaper process because I don't have to use a resource-heavy JPanel , but probably wouldn't look as good). 这种方法的问题在于,我可能不得不添加一堆空的JLabel或者只是忘记了整个upperPanel想法,而直接添加到JFrame (这将是一个更便宜的过程,因为我不必使用资源繁重的JPanel ,但看起来可能不太好)。

Would you advise against adding a bunch of empty JLabel s? 您是否建议不要添加一堆空的JLabel

Is adding empty JLabels an expensive process? 添加空的JLabels是否昂贵?

No, it is not. 不它不是。

我还发现了有关Fillers的信息(我问这个简单问题的原因): http : //docs.oracle.com/javase/7/docs/api/javax/swing/Box.Filler.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM