Java Netbeans:如何将面板分层?

发布于 2024-12-26 02:21:33 字数 273 浏览 2 评论 0原文

请耐心等待,因为我刚刚开始第一次使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

也只是曾经 2025-01-02 02:21:33

教程应该为您指明正确的方向,但是,如果如果您想让项目彼此重叠,您可能还想查看 卡片布局

CardLayout 类管理两个或多个组件(通常是 JPanel
实例)共享相同的显示空间。

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:

The CardLayout class manages two or more components (usually JPanel
instances) that share the same display space.

桜花祭 2025-01-02 02:21:33

阅读你的问题我不认为你需要的是一个LayeredPane

基本上我想做的是创建适合一个框架的不同面板,但一次只能看到一个面板。

准确地告诉您想要实现的目标,我的意思是您想要实现的目标正在努力。

...根据用户输入的内容,弹出与用户输入内容相对应的面板。

我想建议一个 JDialog ,根据用户输入显示对话框。为了确定这是否是您所需要的,您需要向我们提供更多信息。 :)

Reading your question I dont think that what you need is a LayeredPane,

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.

Tell exactly what you want to achieve, I mean on what you are working on.

...and depending on what the user inputs, the panel that corresponds to what the user puts in pops up.

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. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文