如何在Java Swing中使用Label实现视图?

发布于 2024-12-16 18:52:36 字数 157 浏览 2 评论 0原文

假设后面使用的是JTextPane,我想实现一个带有标签的视图。但是如何在 Java 中实现视图呢?这与 Java Swing 上 iPhone 上的 UIView 类似吗?谢谢。 在此处输入图像描述

Assume that the back is using a JTextPane, and I would like to implement a view with a label. But how can I implement the view in Java? is that something like UIView on iPhone on the Java Swing? Thanks. enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

山人契 2024-12-23 18:52:37

这没什么特别的;只需在窗口底部打包一个额外的 JPanel,然后在其中放入一个 JLabel 即可;根据需要设置 JLabel 的文本。

There's nothing special about this; just pack an extra JPanel along the bottom of your window, and put a JLabel into it; set the text of the JLabel as needed.

眼眸印温柔 2024-12-23 18:52:36

如果我理解正确的话,您希望在 JTextPane 顶部显示一个 JLabel 。如果是这样,请使用JLayeredPane

阅读有关分层窗格的 Swing 教程,了解如何使用它们。

If I understand correctly, you would like to display a JLabel on top of a JTextPane. If so, use a JLayeredPane.

Read the Swing tutorial on layered panes to learn how to use them.

软糯酥胸 2024-12-23 18:52:36

您在寻找这样的东西吗?

在此处输入图像描述

请参阅 闪烁

Are you looking for something like this?

enter image description here

See Twinkle

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