Solved

Creating vertical text in JTabbedPane tabs

Posted on 2001-08-28
2
1,288 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cipher Configuration on Apache HTTPD 4 62
replace a word with other 1 44
web services creation SOAP vs REST 5 41
Desingning Refactoring existing code 2 24
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

778 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