Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabbed pane scroll viewport edge fade gradients #344

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

xDUDSSx
Copy link
Contributor

@xDUDSSx xDUDSSx commented Jun 23, 2021

This PR adds a different way of handling tabbed pane edge clipping when using the scroll tab layout.
Instead of a hard cutoff and title string clipping, gradients are added on the sides that obscure the tabs, making them disappear gradually.

Comparison

tabFadeouts

Why

It looks a bit better in my opinion. I don't feel like the title clipping with "..." is particularly modern.
Inspiration comes from IntelliJ's IDEA where tabs have this exact effect

intellijTabFadeouts

Potential issues

  • It makes a tab partially disappear even when it's selected and fully visible. That could probably be explicitly solved, but curiously that happens in IDEA too. Think the easiest solution to that is to keep the gradient width smaller or equal to the left/right tab insets (in case of TOP tab placement).

  • It does not look so good (imo) with LEFT/RIGHT tab placements. The gradients could perhaps be made smaller for those cases or not use them at all.

Usage

Its controlled with two UIManager properties

TabbedPane.scrollEdgeFadeout = true
TabbedPane.scrollEdgeFadeoutWidth = 12

It works by placing two components on the edges using the scroll tab layout manager, much like the forward/backward buttons. The selection indicator is not obscured, which required adding a way to track its position in the paintTabSelection() method.
Because of that it does conflict with the other PR I recently opened #343 but that can be easily resolved.

xDUDSSx added 2 commits June 22, 2021 02:28
…lable viewport, gradients are added to the sides to make tabs gradually disappear, replacing title clipping.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant