Solved

Creating vertical text in JTabbedPane tabs

Posted on 2001-08-28
2
1,282 Views
Last Modified: 2012-05-04
Using the setTabPlacement(JTabbedPane.LEFT) I am able to
orient the tabs of a JTabbedPane on the left, but the tabs and the tab label are still horizontal.  Is there a way to orient the tabs vertically and the text on the tab label to read vertical instead of horizontal (such that the tab and the tab label's text are rotated 90 degrees counterclockwise)?

 
0
Comment
Question by:LonAllen
2 Comments
 
LVL 4

Accepted Solution

by:
sdussinger earned 25 total points
ID: 6434555
From a little cursory digging through the Swing source, it doesn't appear that there's any way to do this directly.

All of the actual drawing of the tabs is handled within the L&F code for TabbedPanes. In essence, each L&F (windows, metal, basic etc) contain code to draw the tabs specific for the L&F in use.

You could certainly create your own L&F based on one of the existing L&F types, but that'd be a bunch of work. You'd need to override the code which calculates the rects for each tab and the code which draws the tabs.

You could also subclass the JTabbedPane class and override the paint method, but in that case you'd have to do all of the drawing yourself, including calculating the positions of the tabs and nested tab runs, etc. Also not an easy task.  Additionally, your new subclass would not obey the pluggable L&F guidelines if you did it this way.

Again, I just did a little cursory digging through the Swing source, maybe someone else out there knows a way to do this...

--Steve
0
 

Author Comment

by:LonAllen
ID: 6436243
Steve, thanks for the response.  I too came to a similar conclusion based upon what I found, that is why I am asking to see if anyone else has done it.  The only solution that I can currently see as being the simplest is to create images of the vertical text and use the images on the tabs instead of text.  If I get creative I could create images for the text used in each L&F and at least there would be some consistency when the L&F is changed.  

Thanks again...
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now