最佳答案
查看 JTabbedPane.setTabComponentAt( int index, Component component )
方法。此方法允许您设置用于呈现标题的组件。
文档描述:
Sets the component that is responsible for rendering the title for the specified tab. A null value means JTabbedPane will render the title and/or icon for the specified tab. A non-null value means the component will render the title and JTabbedPane will not render the title and/or icon.
Note: The component must not be one that the developer has already added to the tabbed pane.
你可以做什么:
- 创建
JTabbedPane
- 向其添加一个新标签,其预期功能类似于 chrome 的“添加标签页”
- 将该选项卡的标题组件设置为按钮(适当设置样式)
- 单击该按钮时,在按钮选项卡之前添加一个新选项卡并显示新添加的选项卡
关于java - 如何在JTabbedPane后台添加按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41133515/