Eclipse 风格的选项卡式窗格——“显示列表"选项卡过多时的按钮 [英] Eclipse-style tabbed pane -- "Show List" button when too many tabs

查看:45
本文介绍了Eclipse 风格的选项卡式窗格——“显示列表"选项卡过多时的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 Swing 应用程序,用户可以在其中动态地将选项卡添加到选项卡式窗格中.我们遇到了这样一个问题,即用户添加了太多标签,以至于它们不能全部放在一行中.我知道选项卡布局策略有两个选项(滚动策略最终可能就足够了),但我很好奇是否有办法在 Swing 中复制 Eclipse显示列表"按钮.也就是说,如果您使用 Eclipse IDE 并且一次打开太多 Java 文件,则选项卡式窗格将在最右侧选项卡的右侧添加一个按钮,您单击该按钮可显示一组隐藏"选项卡,即不适合的标签.这可能吗?

I'm working on a Swing application where the user can dynamically add tabs to a tabbed pane. We are running into the problem where the user adds so many tabs that they don't all fit on one line. I know that there are two options for the tab layout policy (and the scrolling policy may ultimately be sufficient), but I'm curious if there's a way to replicate the Eclipse "Show List" button in Swing. That is, if you are using the Eclipse IDE and you open, say, too many Java files at once, the tabbed pane will add a button to the right of the rightmost tab that you click to show a set of "hidden" tabs, i.e. the tabs that don't fit. Is this possible?

谢谢,

大卫

推荐答案

我第一次对两个不同的问题有重复的回答.

First time I've had a duplicate answer to two different questions.

您必须编写自己的 BasicTabbedPaneUI 类,您自己的 JTabbedPane,以及您自己的其他几个类的版本,以引用您的新类.玩得开心.

You would have to write your own version of the BasicTabbedPaneUI class, your own version of JTabbedPane, and your own version of several other classes to reference your new classes. Have fun.

这篇关于Eclipse 风格的选项卡式窗格——“显示列表"选项卡过多时的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆