Java Netbeans:如何将面板分层?
请耐心等待,因为我刚刚开始第一次使用 NetBeans!基本上我想做的是创建适合一个框架的不同面板,但一次只能看到一个面板。它将从一个面板开始,根据用户输入的内容,弹出与用户输入内容相对应的面板。
我尝试过使用 LayeredPanes,因为那是我经过几个小时的研究才得出的。我不明白该怎么做!我认为使用不同的面板比使用不同的框架容易得多,所以这就是为什么我坚持使用分层面板。
如果有人能解释 LayeredPanes,我将非常感激!我不确定我的编码在这里会有帮助,但如果有人需要它,我会把它放上来。
Please bear with me as I've just started using NetBeans for the first time! Basically what I'm trying to do is create different panels that fit inside one frame, except that only one panel will be visible at a time. It'll start with one panel, and depending on what the user inputs, the panel that corresponds to what the user puts in pops up.
I've tried looking into utilizing LayeredPanes since that's what I've come after hours of researching this only.. I don't understand how to do it! I think using different panels would be much easier than using different frames, so that's why I'm just going to stick with layering panels.
If anyone could explain LayeredPanes, I'd be very grateful! I'm not sure my coding will help here, but if anyone needs it I'll put it up.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
本教程应该为您指明正确的方向,但是,如果如果您想让项目彼此重叠,您可能还想查看 卡片布局:
This tutorial should point you in the right direction, however, if you want to have items positioned over each other, you might also want to take a look at the CardLayout:
阅读你的问题我不认为你需要的是一个
LayeredPane
,准确地告诉您想要实现的目标,我的意思是您想要实现的目标正在努力。
我想建议一个 JDialog ,根据用户输入显示对话框。为了确定这是否是您所需要的,您需要向我们提供更多信息。 :)
Reading your question I dont think that what you need is a
LayeredPane
,Tell exactly what you want to achieve, I mean on what you are working on.
I'd like to suggest a JDialog , show dialogs depending on the user inputs. To make sure if this is what you need, you want to provide us with more information. :)