Skip to content

Fix: Improve JTabbedPane tab title rendering#1120

Open
poce1don wants to merge 1 commit into
JFormDesigner:mainfrom
poce1don:jtabbedpane-title-refine
Open

Fix: Improve JTabbedPane tab title rendering#1120
poce1don wants to merge 1 commit into
JFormDesigner:mainfrom
poce1don:jtabbedpane-title-refine

Conversation

@poce1don
Copy link
Copy Markdown
Contributor

@poce1don poce1don commented May 8, 2026

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 placements

Scale 125%
scale125

Scale 150%
scale150

Vector-based Rendering: For rotated text, the implementation now uses TextLayout.getOutline() to render the title as a Shape. 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 drawStringUnderlineCharAt for horizontal tabs to maintain peak performance and native font rendering consistency.

Mnemonic Support: Manually implemented the underline logic for vertical text using TextHitInfo, ensuring the mnemonic remains 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.

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