Solved

Creating vertical text in JTabbedPane tabs

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Understanding websocket example in spring 1 54
rhino JavaScript import, load 25 66
Java Options in Zimbra Server 2 44
web services creation SOAP vs REST 5 19
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

919 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

21 Experts available now in Live!

Get 1:1 Help Now