Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 42219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:18:14+00:00 2026-05-10T15:18:14+00:00

I’m looking to have text display vertically, first letter at the bottom, last letter

  • 0

I’m looking to have text display vertically, first letter at the bottom, last letter at the top, within a JLabel. Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T15:18:14+00:00Added an answer on May 10, 2026 at 3:18 pm

    I found this page: http://www.java2s.com/Tutorial/Java/0240__Swing/VerticalLabelUI.htm when I needed to do that.

    I don’t know if you want the letters ‘standing’ on each other or all rotated on their side.

    /*  * The contents of this file are subject to the Sapient Public License  * Version 1.0 (the 'License'); you may not use this file except in compliance  * with the License. You may obtain a copy of the License at  * http://carbon.sf.net/License.html.  *  * Software distributed under the License is distributed on an 'AS IS' basis,  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for  * the specific language governing rights and limitations under the License.  *  * The Original Code is The Carbon Component Framework.  *  * The Initial Developer of the Original Code is Sapient Corporation  *  * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.  */   import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.Rectangle; import java.awt.geom.AffineTransform;  import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.plaf.basic.BasicLabelUI;  /**  * This is the template for Classes.  *  *  * @since carbon 1.0  * @author Greg Hinkle, January 2002  * @version $Revision: 1.4 $($Author: dvoet $ / $Date: 2003/05/05 21:21:27 $)  * @copyright 2002 Sapient  */  public class VerticalLabelUI extends BasicLabelUI {     static {         labelUI = new VerticalLabelUI(false);     }      protected boolean clockwise;       public VerticalLabelUI(boolean clockwise) {         super();         this.clockwise = clockwise;     }       public Dimension getPreferredSize(JComponent c) {         Dimension dim = super.getPreferredSize(c);         return new Dimension( dim.height, dim.width );     }      private static Rectangle paintIconR = new Rectangle();     private static Rectangle paintTextR = new Rectangle();     private static Rectangle paintViewR = new Rectangle();     private static Insets paintViewInsets = new Insets(0, 0, 0, 0);      public void paint(Graphics g, JComponent c) {          JLabel label = (JLabel)c;         String text = label.getText();         Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();          if ((icon == null) && (text == null)) {             return;         }          FontMetrics fm = g.getFontMetrics();         paintViewInsets = c.getInsets(paintViewInsets);          paintViewR.x = paintViewInsets.left;         paintViewR.y = paintViewInsets.top;          // Use inverted height & width         paintViewR.height = c.getWidth() - (paintViewInsets.left + paintViewInsets.right);         paintViewR.width = c.getHeight() - (paintViewInsets.top + paintViewInsets.bottom);          paintIconR.x = paintIconR.y = paintIconR.width = paintIconR.height = 0;         paintTextR.x = paintTextR.y = paintTextR.width = paintTextR.height = 0;          String clippedText =             layoutCL(label, fm, text, icon, paintViewR, paintIconR, paintTextR);          Graphics2D g2 = (Graphics2D) g;         AffineTransform tr = g2.getTransform();         if (clockwise) {             g2.rotate( Math.PI / 2 );             g2.translate( 0, - c.getWidth() );         } else {             g2.rotate( - Math.PI / 2 );             g2.translate( - c.getHeight(), 0 );         }          if (icon != null) {             icon.paintIcon(c, g, paintIconR.x, paintIconR.y);         }          if (text != null) {             int textX = paintTextR.x;             int textY = paintTextR.y + fm.getAscent();              if (label.isEnabled()) {                 paintEnabledText(label, g, clippedText, textX, textY);             } else {                 paintDisabledText(label, g, clippedText, textX, textY);             }         }          g2.setTransform( tr );     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 72k
  • Answers 72k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Well, I found out that CodeRush does this. May 11, 2026 at 1:47 pm
  • added an answer Take a look at the system stored procedure: sp_getapplock It… May 11, 2026 at 1:47 pm
  • added an answer Referencing an external ResourceDictionary (XAML File): <Application.Resources> <ResourceDictionary Source='MyResources.xaml' />… May 11, 2026 at 1:47 pm

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.