This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Inclined Text of JLabel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Inclined Text of JLabel" Watch "Inclined Text of JLabel" New topic

Inclined Text of JLabel

kumarjit banerjee
Ranch Hand

Joined: Mar 27, 2011
Posts: 32


I have worked on some basic application in java swing, such as reading a text from JTextField, or implement some logic on the event generated by JButton. I have gone thorough the topics in the internet of how to create a button of custom shape as compared to JButton which is rectangular in shape. I want to know is there someway to display the text in the JLabel in an inclined way. I have attached an image for clarification. Suppose I want to create JLabel as

It will display the text JLabel as the text in the image (left side)
I want to display the text as in the image at the right side

Please suggest me how can I achieve this.

[Thumbnail for JLabel.JPG]

Luigi Plinge
Ranch Hand

Joined: Jan 06, 2011
Posts: 441

No easy way, but see Rob Camick's page Rotated Icon, and set the label as an icon.

There's an a tutorial on text manipulation here that might be useful, if you see the section "An New Slant on Text" and apply a different AffineTransform.
I agree. Here's the link:
subject: Inclined Text of JLabel
Similar Threads
BufferedImage to Icon - have I done this in the correct way?
Problem in inserting record,,1st rec is added once, 2nd record is added twice, and so on,,,!!
Arrays Won't Work
Display and select Images in JApplet
Problem in alignment of its text in JButton with its image