Solved

Creating vertical text in JTabbedPane tabs

Posted on 2001-08-28
2
1,320 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

623 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