Solved

Creating vertical text in JTabbedPane tabs

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
xampp tool 12 58
Oracle SQL syntax check  without executing 6 99
maven module vs maven project 3 68
collection output issue 9 58
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.

679 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