简体   繁体   English

Eclipse样式的选项卡式窗格—选项卡过多时,“显示列表”按钮

[英]Eclipse-style tabbed pane — “Show List” button when too many tabs

I'm working on a Swing application where the user can dynamically add tabs to a tabbed pane. 我正在使用Swing应用程序,用户可以在其中将选项卡动态添加到选项卡式窗格。 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. 我知道选项卡布局策略有两个选项(滚动策略最终可能就足够了),但是我很好奇是否有一种方法可以在Swing中复制Eclipse“ Show List”按钮。 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, ie the tabs that don't fit. 也就是说,如果您使用的是Eclipse IDE,并且一次打开了太多的Java文件,则该选项卡式窗格将在最右边的选项卡的右侧添加一个按钮,单击该按钮可显示一组“隐藏”的选项卡,即不合适的标签。 Is this possible? 这可能吗?

Thanks, 谢谢,

David 大卫

First time I've had a duplicate answer to two different questions. 第一次,我对两个不同的问题有一个重复的答案。

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. 您必须编写您自己的BasicTabbedPaneUI类版本,您自己的JTabbedPane版本,以及您自己的其他几个类的版本才能引用您的新类。 Have fun. 玩得开心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM