Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces support for closable tabs.
Set client property
JTabbedPane.tabClosable
totrue
on aJTabbedPane
to enable closing tabs.You also have to provide a callback in client property
JTabbedPane.tabCloseCallback
that is responsible for closing the tab.If you do not need the tabbed pane in the callback, it is possible to use a
java.util.function.IntConsumer
:To show a tooltip if the mouse is over the close button, set the client property
JTabbedPane.tabCloseToolTipText
:You can set the three client properties also on single tabs. E.g. if not all tabs should be closeable. Or if only some tabs should be closable.
The style of the close button can be changed via UI properties. Here are the defaults for light themes:
If you prefer circle close buttons, set arc to a large value and make filled cross smaller:
If you don't want a filled button on hover, but change cross color to red, try:
This is part of TabbedPane improvements as discussed in issue #40 (comment) and #31.
CC @Gaarco @swordmaster2k