Fix: Improve JTabbedPane tab title rendering#1120
Open
poce1don wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 improves the rendering of tab titles in
JTabbedPane,specifically when tabs are placed vertically (Left/Right). Previously, rotated text often exhibited minor visual distortions and aliasing issues. Vertical text rendering is now much closer in quality to horizontal rendering, providing a more professional and consistent UI look across all tab placementsScale 125%

Scale 150%

Vector-based Rendering: For rotated text, the implementation now uses
TextLayout.getOutline()to render the title as aShape.This ensures high-quality vector-based rendering, eliminating the "blurred" or "jagged" look that sometimes occurred with standard string drawing during rotation.Horizontal Rendering: Kept the original
drawStringUnderlineCharAtfor horizontal tabs to maintain peak performance and native font rendering consistency.Mnemonic Support: Manually implemented the underline logic for vertical text using
TextHitInfo,ensuring themnemonicremains perfectly aligned with the vector-based title.Important Notes:
This improvement applies only to plain text titles. For tabs using HTML content, the original
View.paint()logic is preserved, and the rendering remains unchanged.