JTabbedPane:选项卡本身之前和之后的组件

发布于 2024-07-22 14:44:49 字数 604 浏览 6 评论 0原文

这类似于问题 如何在 Java Swing 中构建 Google-chrome 选项卡和菜单栏界面?(我想完成同样的任务),但更重要的是:如何将组件放在 JTabbedPane 中选项卡的前面和后面?

我自己已经提出了按钮的想法,但我宁愿有一个 JTabbedPane,因为它确实如此,但侧面装饰有按钮或图标。

我已经看到 Kirill 的 laf-widget 项目做了类似的事情(放大- 选项卡左侧的玻璃图标)用于多个 LaF。 然而,我必须承认,我还不够熟练,无法理解他是如何做到这一点的 - 而且这似乎是一个有点复杂的过程,其中一个人“物理地”改变有问题的 LaF(字节码操纵它),注入 laf - 将小部件内容放入 UI 委托中 - 我仍然不知道 JTabbedPane 或 TabbedPaneUI 实际上是如何调制以注入该图标/按钮的。

This is similar to the question How to build a Google-chrome tabs and menubar interface in Java Swing? (I want to accomplish the same), but more to the point: How do I put components in front and behind the tabs in a JTabbedPane?

I've already come up with the buttons-idea myself, but I'd rather have a JTabbedPane, since that is really what it is, but decorated with a button or icons on the sides.

I've seen that the laf-widget project from Kirill does something like it (the magnifying-glass icon to the left of the tabs) for several LaFs. However, I must admit that I'm not yet well enough versed to understand how he does it - and also it seems like a somewhat complicated process, whereby one "physically" change the LaF in question (bytecode manipulates it), injecting the laf-widget stuff into the UI delegates - and I still don't know how the JTabbedPane or TabbedPaneUI is actually modulated to inject that icon/button.

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

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

发布评论

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

评论(2

つ可否回来 2024-07-29 14:44:49

我最后向 Substance LaF/laf-widget 的基里尔询问了他如何设法将装饰 JTabbedPanes 的 laf-widget 选项卡前面的按钮,这是他的回复:

它依赖于
BasicTabbedPaneUI.tabAreaInsets 字段
为按钮腾出空间,并且
按钮的自定义 setBounds
组件将自己定位在其中
面积。

更多代码请参见TabOverviewButton
和 TabOverviewDialogWidget 类
laf-widget 项目。

一般来说,选项卡式窗格 UI
delegate 是最少的之一
有吸引力的增强,因为它
有很多私有和包
受保护的方法

谢谢,基里尔!

I finally asked Kirill of Substance LaF/laf-widget of how he manages to put a button in front of the tabs in the laf-widget that decorates JTabbedPanes, and this is his reply:

It relies on the
BasicTabbedPaneUI.tabAreaInsets field
to make room for the button, and
custom setBounds of the button
component to position itself in that
area.

For more code, see TabOverviewButton
and TabOverviewDialogWidget classes in
the laf-widget project.

In general, the tabbed pane UI
delegate is one of the least
attractive ones to enhance since it
has a lot of private and package
protected methods

Thanks, Kirill!

一梦等七年七年为一梦 2024-07-29 14:44:49

JIDE 有一个选项卡式窗格作为其组件套件的一部分,将该功能公开为简单的 setBeforeComponent() 和 setAfterComponent( ) 方法。

这里有一个演示: http://www.jidesoft.com/products/ 1.4/jide_demo.jnlp

JIDE have a tabbed pane as part of their component suite that exposes this functionality as simple setBeforeComponent() and setAfterComponent() methods.

There's a demo of it in here: http://www.jidesoft.com/products/1.4/jide_demo.jnlp

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