我可以在 JTabbedPane 中将一些选项卡放在左侧,将其他选项卡放在右侧吗?
我可以在 JTabbedPane 中将一些选项卡放在左侧,将其他选项卡放在右侧吗?或者至少添加一些选项卡,然后添加一个空格,然后添加其他选项卡?
谢谢!
Can I put some tabs to the left and others to the right in a JTabbedPane? Or at least to add some tabs, then add an empty space, and then add other tabs?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 CardLayout 并添加按钮。
创建一个使用 BorderLayout 的主面板。将您的 CardLayout 和卡片添加到南边。然后创建两个按钮面板。一种用于西方,另一种用于东方。
或者,您可以使用 BoxLayout,然后在左右按钮之间添加“粘合”,而不是为按钮创建两个面板,布局管理器将自动添加空间。
Use a CardLayout and just add your buttons.
Create a main panel that uses a BorderLayout. Add your CardLayout and cards to the SOUTH. Then create two button panels. One for the WEST and one for the EAST.
Or instead of creating two panels for the buttons you can use a BoxLayout and then add "glue" between the left and right buttons and the layout manager will add space automatically.
不,不幸的是,Swing(或 SWT)不支持这些行为。
(我对你的问题的解释是,由于似乎存在一些混乱,你正在寻找这样的行为:
No, unfortunately, those behaviors are not supported by Swing (or SWT, for that matter).
(My interpretation of your question, since there seems to be some confusion, is that you were looking for behavior like this:
不,我认为你不能。您可以尝试使用添加到面板或分割窗格上的两个选项卡式窗格。例如:
No, I don't think you can. You can try using two tabbed panes added onto a panel or splitpane. For example: