Vertical text in JTabbedPanes on MAC

Hi all,
I use the CrossPlatformLookAndFeel for my Java application and I want to have vertical text in tabs with are placed on the left side. For displaying the vertical text I use a special TabbedPanUI (see code below) which rotates the text. This works fine on Linux and Windows platforms, but on Mac the text is not readable.
Anyone got a clue about this??
Thank for your help
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicGraphicsUtils;
import javax.swing.plaf.basic.BasicTabbedPaneUI;
* @author elkes
public class DOOCSTabbedPaneUI extends BasicTabbedPaneUI {
    /** Creates a new instance of DOOCSTabbedPaneUI */
    public DOOCSTabbedPaneUI() {
        super();
    private Image getVerticalImage(int tabIndex) {
        ImageIcon iconNormale = (ImageIcon) tabPane.getIconAt(tabIndex);
        int iconWidth = (iconNormale != null) ? iconNormale.getIconHeight() : 0;
        int iconHeight = (iconNormale != null) ? iconNormale.getIconWidth() : 0;
        String title = tabPane.getTitleAt(tabIndex);
        FontMetrics metrics = getFontMetrics();
        int titleWidth = (title != null) ? metrics.stringWidth(title) : 0;
        int titleHeight = (title != null) ? metrics.getHeight() : 0;
        int height = iconWidth + titleWidth + textIconGap + 1;
        int width = Math.max(iconHeight, titleHeight);
        if (width==0) width=1;
        boolean isSelected = (tabPane.getSelectedIndex() == tabIndex);
        int tabPlacement = tabPane.getTabPlacement();
        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = image.createGraphics();
        g2.setComposite(AlphaComposite.Src);
        if (tabPlacement == JTabbedPane.LEFT) {
            g2.translate(0, height);
            g2.rotate(-Math.PI / 2);
        } else {
            g2.translate(width, 0);
            g2.rotate(Math.PI / 2);
        Color background = (isSelected) ? UIManager.getColor("TabbedPane.selected")
                : tabPane.getBackgroundAt(tabIndex);
        g2.setColor(background);
        g2.fillRect(0, 0, height, width);
        if (iconNormale != null) {
            g2.drawImage(iconNormale.getImage(), 0, 0, null);
        if (title != null) {
            g2.setFont(metrics.getFont());
            g2.setColor(tabPane.getForegroundAt(tabIndex));
            int mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex);
            BasicGraphicsUtils.drawStringUnderlineCharAt(g2, title, mnemIndex, iconWidth + textIconGap, metrics.getAscent());
        g2.dispose();
        return image;
    private boolean isBottomOrTop() {
        int tabPlacement = tabPane.getTabPlacement();
        return tabPlacement == JTabbedPane.TOP || tabPlacement == JTabbedPane.BOTTOM;
    protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) {
        if (isBottomOrTop()) {
            return super.calculateTabHeight(tabPlacement, tabIndex, fontHeight);
        return super.calculateTabWidth(tabPlacement, tabIndex, getFontMetrics());
    protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) {
        if (isBottomOrTop()) {
            return super.calculateTabWidth(tabPlacement, tabIndex, metrics);
        return getVerticalImage(tabIndex).getWidth(null);
    protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) {
        if (isBottomOrTop()) {
            super.paintText(g, tabPlacement, font, metrics, tabIndex, title, textRect, isSelected);
        } else {
            Image image = getVerticalImage(tabIndex);
            Rectangle r = getTabBounds(tabPane, tabIndex);
            Insets insets = getTabAreaInsets(tabPlacement);
            int dx = r.x + insets.top;
            int dy = r.y;
            if (tabPlacement == JTabbedPane.LEFT) {
                dy += insets.left;
            } else {
                dy += insets.right;
            g.drawImage(image, dx, dy, null);
    protected void paintIcon(Graphics g, int tabPlacement, int tabIndex,
            Icon icon, Rectangle iconRect, boolean isSelected) {
        if (!isBottomOrTop()) {
            return;
        super.paintIcon(g, tabPlacement, tabIndex, icon, iconRect, isSelected);
}

Maybe the approach of using a [url http://tips4java.wordpress.com/2009/04/06/rotated-icon/]Rotated Icon along with the TextIcon, will work on all platforms without using a custom UI.

Similar Messages

  • Vertical text in charts

    How can we write vertical text in charts in a peolesoft

    Hi.
    Having played around with this also, I've concluded that it is not possible. There seems to be no mention in any doc'n of a difference between 2-D and 3-D in this regard. Yet the options for vertical or diagonal X-axis labels are grayed out for 3-D; and if you format that way in 2-D, then change chart type to 3-D, it reverts to horizontal.
    Not knowing how extensive your needs are, here is an admittedly crude kluge that may be of some use: In Chart Data Editor you can delete the X-axis labels, then replace them with text boxes having whatever orientation you want, and group them with the chart - IF the chart also is fixed on the page. Of course, if you have a lot of charts, and/or you need to retain integrity of the labels, this wouldn't be acceptable.
    MacBook Pro   Mac OS X (10.4.9)  

  • Vertical text and Spotlight

    I'm not sure whether this topic is more InDesign, PDF or MacOSX related.
    See this document.
    Is it possible to make the number in the bottom left corner, searchable for Spotlight (MAC).
    The number is set vertically due to corporate guidelines.
    The file doesn't show up with a Spotlight search for that number.
    In Acrobat, the text is fully searchable. Even MAC's own Preview app can find the vertical text, which makes me wonder why Spotlight doesn't index it.
    Even google seems to index the vertical text.
    I don't want to add the number to the filename either, because we have strict file naming conventions to keep everything clear.
    Thanks in advance!

    Meanwhile I did some tests.
    It appears rotated text IS spotlight-searchable, BUT words are seperated in parts.
    For example: the text "ROTATED"
    At 30°, spotlight finds the file until i type the "E" character.
    30°: ROTAT - ED
    60°: ROTA - TED
    90°: RO - TA - TE - D
    It seems to split the words, and spotlight sees the parts as different words.
    While acrobat, mac preview etc. can search any combination characters, spotlight needs the first character of the word (it would never find "OME WOR" when "SOME WORDS" is in the file).
    I tried using tags, hyperlinks / bookmarks, script labels etc, many different PDF export options (PDF tags, invisble objects, PDF versions,…).
    I also played with some InDesign text controls that could cause the text splitting, like kerning/tracking settings, opentype features, hyphenation turned off...
    Also with mirroring (mirrored text is indexed by the way), vertical text in a non-rotated table.
    None of the above made the file spotlight-searchable.
    Opening the PDF in Illustrator shows the the text as 1 part, so I don't know why spotlight sees the words as seperate parts.
    John's invisible text-option looks like the solution to go with.
    Perhaps the "linked content" feature in can handle this, to make sure the visible and invisble text is always synced. (just switched from CS5.5, and didn't test that feature yet).

  • Anyone know how to make vertical text in a table in keynote?

    anyone know how to make vertical text in a table in keynote?

    Just to add a bit more about this question. I have seen in other related questions that this feature (vertical text) is not available in (apparently) the whole iWork09. someone even said that it should be asked to the developers, so they include this feature in iWork10. I find this issue a bit sad. This feature has been present in msOffice since a while, and at least for me, this is quite important for my work. It is also apparently not possible to have different page orientation in the same document, meaning portrait and landscape, so one can have wide tables in a whole page, for example. If this is true, it is again sad, and I just cannot understand why such a basic feature is not available in an already 09 version. I am using only the trial version of iWork, but already in the first day I have discovered that I actually cannot do what I was used to. Again sadly I (and many others I guess) will have to stick to Office until the mac software is fully developed.

  • Vertical text in table heading

    Hi,
    I would like to save some space in some reports and I would like to change orientation of text in table heading.
    Is it posible to have vertical text in table heading?
    What I want is showed on this picture: [Vertical text|¨http://img179.imageshack.us/img179/234/obiverticaltext.jpg]
    Thank you for some tips.

    Hi,
    Go through this...will help you solve your requirement....http://blog.trivadis.com/blogs/andreasnobbmann/archive/2009/07/17/vertical-text-in-obiee.aspx
    Use the same code Writing-mode: tb-rl; filter: flipv fliph; in custom css style of column heading.(column properties->column format->edit format icon beside column heading->css style)
    Regards,
    Srikanth

  • Problem with vertical text in crystal report viewer

    Hi,
    I am displaying vertical text in crystal report designer and deploying the report in crystal reports server 2008. The deployed report is being displayed using JAVA in crystal report viewer control.
    Problem: Vertical text header  is getting collapsed wth other vertical headers.
    Please help on this.
    Thanks,

    Hi Vijay,
    I found out another method of retaining all the chart formatting that is done in the preview pane.
    Once you have done all the changes then you will find interestingly there is a chart menu option that appears in the tool bar. Once you click on it there is an option "Apply Changes to All Charts".
    Select that option, close your preview. Open it once again and you will find that all the settings are still there and the Web Viewer is able to display them properly.
    I think that I resolved this.
    Regards,
    Gourav

  • Printing vertical text in SMART FORMS

    Hi,guys iam fresher to this environment and i just want to print vertical text in SMARTFORMS.Will you please provide any information regarding this.

    Hi Raja,
       As far as my knowledge its not possible in Smartforms.
      I had the same requirement , what I had done is I have created a text in word and saved that as BMP and used that logo inside that window. But the requirement for me was that the TEXT was Static means it was not changing.
    Reward points if Helpful
    Regards
    Avi.........

  • Make a pdf ocr text searchable on a mac with adobe

    How do I make a pdf ocr text searchable on a mac with adobe

    With "adobe" what: Acrobat?  What version?

  • Vertical Text in PDF using CFDOCUMENT

    I am using font tag in a CSS file to layout a table header
    using vertical text. In HTML, the vertical text looks fine.
    However, when I convert the table to a pdf using
    <cfdocument>, the vertical text is displayed as horizintal
    text and does not follow the css specified font family, color or
    size.
    Here is the line in the CCS I am referencing:
    .header_vertical {FONT-WEIGHT: bold; FONT-SIZE: 8pt;
    FONT-STYLE: normal; writing-mode:tb-rl; FONT-FAMILY: helvetica,
    arial, verdana, sans-serif; TEXT-DECORATION: none; COLOR: #0f437c}
    This is CFMX7 on a Windows Server 2003 OS running IIS.
    Any ideas???
    Thanks.

    Hi there, did you find a solution to this?
    I had the same issue and no matter what i tried it didn't
    work. I found out that CFDOCUMENT doesn't support CSS2.
    Eventually I came up with a clunky solution, but had no other
    choice. I bought some imaging software called Alagad (
    http://www.alagad.com) which
    produces the vertical text as images on the fly. Its not ideal, but
    there was no ther way I could disply the text.
    Hope this helps you.
    Ally

  • Weird problem with vertical text in a table

    Hello,
    I am new on this forum, usually I don't post because I always find the answer to my question, but this is something quite weird...
    I have a table with vertical text in it (it has to be vertical because the cells are narrow). And I want it to be centered in the cell, both vertically and horizontally. When the cell is high enough, no problem. But as it becomes shorter, the text moves to the left. It is exactly as if there was a right margin within the cell, which is not the case.
    See the example below : I had the text right-aligned (this is to say, bottom-aligned, as it is 270° rotated) to make it more visible.
    Can someone help me there ? I already spent hours on that problem..!
    Thank you very much !

    Only, my table contents both vertical and horizontal text, so I can't. But thanks for the suggestion.
    Thank you kindly for all your answers. Anyway, re-writing the text in separate frames won't be so difficult (anyway it'll always take less time than what that problem already did..).
    So I have a solution, thanks to Phorna
    But remains the frustration of not finding the reason of this ! I will live along with it
    Thanks to all

  • Version 3.6.17 Horizontal drop down menu is displaying as vertical text list. Page style set to basic. Menu works fine in Internet Explorer. Any hints?

    Newly installed horizontal drop down menu works in IE. In Firefox, it displays as a vertical text list. Any hints?

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    * Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove the Cookies" from sites causing problems:
    * Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • Creating Vertical text in horizontal position ... ??

    Hi
    I am tring to print text onto address labels in a vertical orientaion (for final use). I have a large CD collection and I am trying to print headings for plastic cards that have a small tab that sticks out. I found small address labels to be the perfect size to stick on. However, I will be appling the labels vertically.
    Pages allows you to take horizontal text and rotate it, BUT the letters are NOT stacked on top of each other, you just end up with diagnol or sideways rotated text.
    WordArt in MS Word allows you to orient the text the way I want, but I was hoping for an easier solution in Pages - as the resizing in wordart is cumbersome and fixed to varies intervalls, you cannot enter specific number sizes.
    I hope I was decribing this clearly.
    Thanks AL

    You can achieve the effect you want by creating a text box (it should be set for Moves With Text and Wrap should be off). Type your text with a return after each letter and then narrow the box to fit the vertical text. Next, in the Text Inspector center the text. Go to the Metrics inspector and type "90" in the Angle box at the bottom.
    You should be able to copy and paste this to your template.
    Walt

  • Vertical text direction / orientation in tables. (RoboHelp 7 and/or 8)

    Hello all,
    I need to squeeze a fairly full table (lots of columns) into a printable page width.
    In order to do this, I need to put text into some of the cells so that they read vertically. I can do this in MS Word tables (menu > Format > Text Direction) and need an equivalent in RH. Preferably RH7, (but can import into RH8 if I must ).
    Any ideas anyone?

    Hi Philip
    My guess is that you can probably fudge it using CSS. But it won't be something RoboHelp will assist with in any way.
    Check the link below for one hit I found. Use Google searching for vertical text in HTML to find others.
    Click here to view
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 moments from now - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcererStone Blog
    RoboHelp eBooks

  • Vertical text in CR 2008

    Hello,
    I need to display the text in the columns labels vertically. When I set text rotation to 90 degrees, the text is rotated in the designer, but when I run the report - it's horizontal. However, when I print or export the report, the text is vertical again.
    After searching Google I've found out that this is a known bug in CR. However, I didn't find any solution other than using a CSS file. I've never used CSS with the Crystal Reports, so I wonder - is there any other solution to this problem? I need the text to be vertical on the web site as well.
    Thank you.

    The following information may help you
    Symptom
    Crystal Reports XI using vertical text is displayed correctly in Crystal reports designer.
    When exported reports are viewed in web appplication like Infoview, the report text is displayed horizontally.
    Reproducing the Issue
    Text rotated by 90 Degrees to vertical, changes back to horizontal.
    Environment:
    Crystal Reports XI
    Cause
    Crystal reports does not display the text as required,in normal view.
    Resolution
    1) Login to Infoview
    2) Click on preferences icon on the upper-right corner.
    3) Click on Crystal reports
    4) Select Active X Viewer
    5) Click Ok
    Keywords
    Vertical text, Horizontal text, Crystal Reports,Active X viewer
    Regards,
    Raghavendra

  • Vertical Text in Smartforms

    Hello,
    how can I get vertical texts in Smartforms? In need it for headings in a table, because of limited space.
    I only get things like that:
    e.g.
    P
    o
    s
    i
    t
    i
    o
    n
    But I need to rotate the whole word... Is there any solution?
    Thanks and regards!

    Hi,
    Check the below links.
    http://www.sapfans.com/forums/viewtopic.php?t=9972
    http://searchsap.discussions.techtarget.com/WebX?[email protected]@.ee83dd4/1576
    Thanks,
    ramakrishna

Maybe you are looking for

  • My firefox is running very slow and crashes and the curcular thing at the top keeps spinning

    Hi, Recently my firefox has been running very slow. Its take long to browse all websites and sometimes it takes really long when the circular thing at the top left hand corner keeps spinning. When that happens; if I click on the page the screen goes

  • Client Side Signature of PDF in HTML Viewer returning the chnaged/signed PDF.

    Hi, I am generating a SFP PDF form which I then immediately save to a SAP PSRM Case.  I generate the PDF form 'fillable' and I have inserted a Signature Field in the form layout. I have a requirement to save the signed form to the case once it has be

  • Setting up small business

    Will i web work for setting up a small business webpage. Specifically will it support putting on a system for submitting payments (where could i find this??) and is it possible to lock only certain pages with a password - so the site is public but ce

  • HT1918 Where exactly is the 'None' button for payment methods.

    Nothing is showing up besides Visa, Master Card, Paypal, etc. And I JUST redeemed a $50 iTunes card, so of course I wanna be able to use it. Quite frankly, this has never happened before. What do I do to stop it from asking for my credit card informa

  • Coding help?

    I am relatively new to web design and I just developed www.paintingbydarlene.com for a friend and on some monitors it shows up correctly, but on wider screens, the header, links, text, etc all show up to the left of the grey box and I'm not sure what