JLabel (or any text) - vertical orientation.

hey all,
I'm replacing a spreadsheet driven system with a swing app - one of the requirements is that it look similar to the spreadsheet. The spreadsheet of course has nice column headings - labels turned clockwise 90 degrees.
Is there a way to do this? I'm guessing if there is I'm just looking in the wrong spot - a pointer would be appreciated.
cheers
dim

q&d
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.*;
public class Turn90LabelTest extends JPanel {
      public class Turn90Label extends JLabel {
            public Turn90Label( String s )
               super( s );
               setPreferredSize( new Dimension( 30, 90 ) );
               setMinimumSize( new Dimension( 30, 90 ) );
            public void paintComponent(Graphics g) {
               Graphics2D g2d = (Graphics2D)g;
               g2d.translate(10.0, 50.0);
               g2d.rotate( 300 );
               g2d.drawString('Java', 0, 0);
      public Turn90LabelTest()
         add( new Turn90Label( "Java" ) );
      public static void main(String[] args) {
         JFrame f = new JFrame();
         JPanel p = (JPanel) f.getContentPane();
         p.add( new Turn90LabelTest() );
         f.pack();
         f.show();
}

Similar Messages

  • I have a PDF with a diagram, I need to translate the text so I open it in Illustrator.  The document opnes up vertically oriented  I try to put it horizontal to be able to read and change the text  However everything I have done is not working  The artboa

    I have a PDF with a diagram, I need to translate the text so I open it in Illustrator.  The document opens up vertically oriented  I try to put it horizontal to be able to read and change the text  However everything I have done is not working  The artboard does change, but the diagram stays vertical.....Please help  I need to finish that for today..Please help

    A PDF usually consists of one to an indefinite number of clipping masks inside each other.
    You need to be very carefull with selecting stuff.
    So you need to read the manual on how to select stuff and on the basics of Illustrator.
    On top of that: because of the complex hierarchy of PDF files, it is kind of difficult to help you without seeing anything.

  • Over the past week the Mac mail app on my iPad 2 has become locked in vertical orientation and only in the orientation such that the bottom is orientated toward the menu button. Any advice? This is the only app that seems to have been affected.

    For the past week or two, my Mac Mail app for my iPad 2 has been stuck in vertical orientation. This is the only app that is similarly affected. Moreover, it will only orient itself such that the bottom is toward the menu button on the iPad.  Please advise if you have a solution.

    Try closing the Mail app via the taskbar and see if it rotates when you re-open the app : from the home screen (i.e. not with the Mail app 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Mail app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    If that doesn't work also do a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • How to print text vertically in smart forms

    hi,
    Can any one tell how to print text vertically in smartforms
    ADVANCE THANKS
    GUHAPRIYAN

    HI,
    Chk out  this thread.Maybe it proves helpful.
    Re: vertical writing in smartforms
    Regards,
    Gayathri

  • How to display TEXT vertically in SMART FORM

    Hai,
    I need to display the column name of a table vertically (readable from bottom to top) in smart form.
    Could any one please tell me how to do this?
    Thanks & Best Regards,
    Maniyam Bhaskar.

    Hi,
    Go through these threads for the discussions happened on similar issue... hope it helps you..
    how to print text vertically in smart forms
    vertical and horizontal printing in same page with smartforms or sapscript
    Good luck
    Narin

  • SuperFrench is found but this font can not display any text

    "SuperFrench" font comes from Autodesk. this fonts's real file name is supef__.ttf
    If it is placed in C:\Windows\Fonts folder then it is available for Windows native apps such as MS Excel.
    Java GraphicsEnvironment finds "SuperFrench" font
    but this font can not display any text.
    This happens in both Java6(1.6.0_34) and Java7(1.7.0_06)
    try this
    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
    public class FontTest01 {
      public static void main( String[] args ){
        FontTest01 app = new FontTest01();
        app.run();
      void run() {
        String fontName = "SuperFrench"; //** SuperFrench font
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        String[] existFontNames = ge.getAvailableFontFamilyNames(Locale.ENGLISH);
        boolean fontExists = false;
        for( int i=0 ; i<existFontNames.length ; i++ ){
          if( existFontNames.equals( fontName ) ){
    fontExists = true; break;
    if( fontExists==false ){
    System.out.println( fontName +" does not exist" );
    System.exit(-1);
    JLabel label = new JLabel( "ABCDEFG" );
    Font font = new Font( fontName, Font.PLAIN, 20 );
    System.out.println( font.getFontName() );
    label.setFont( font );
    JFrame f = new JFrame();
    f.add( label );
    f.setSize( 180, 120 );
    f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    f.setVisible(true);
    Edited by: TadashiOhmura on 2012/06/17 23:04
    Edited by: TadashiOhmura on 2012/06/18 7:50                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Thank you for your replay.
    I face the same trouble with JavaFX
    I report this problem into Jira and filed as RT-22641
    Some members of Oracle developer team write comments for this issue.
    http://javafx-jira.kenai.com/browse/RT-22641
    This font has some irreguler structure.
    I hope Java font system will deal with it.

  • Can I use a MBA external DVD in a vertical orientation?

    Can I use a MBA external DVD in a vertical orientation? Will the drive be damaged in the long run?

    The vertical orientation won't damage the drive.  The only real concern is for discs in the drive.  In general there should not be any problem as long as the drive isn't being jostled during use.  So you should be OK using it that way.  If you find that the drive isn't reading/writing discs properly then try using it horizontally to see if that fixes things.

  • Bottom row of the keyboard is not working in a vertical orientation on the iPhone 3Gs. the "slide to unlock" and all keys on the calculator on both orientation works fine. I can use the keyboard on horizontal orientation.

    Bottom row of the keyboard is not working in a vertical orientation on the iPhone 3Gs. the "slide to unlock" and all keys on the calculator on both orientation works fine. I can use the keyboard on horizontal orientation. The tabs on bottom of all apps also work fine.
    I have already tried holding down the power button and home button for 10 seconds, but no difference.

    I've had this problem on and off for the last few weeks (around, but not directly related, to upgrade to 6.1...can't remember if was before or after)....I'm very convinced it's a software problem (as there have been times when the bottom row works perfectly, without any need to "press" differently or anything).
    However, it seems to be a rather resilient software issue, as a full restore does not consistently fix it, and it applies to more than just the keyboard; if I open a drawing app, there's definitely a row (about 4mm up from the edge of the screen closest to home button) where I cannot draw.
    It's happened 4 times now.  Originally it went away with a restore from backup, then worked for 2 more days.  The second and third times, it went away with a full restore (although I did two full restores in between those two restores that did nothing, so restore didn't consistently fix it)....and it seemed to return in the most random of circumstances. 
    I paid very close attention to what apps I was using the last time it was working so that I could spot which app, if any, might be causing the issue.  I deleted several apps, I stopped using the games and many other apps.   I only used three apps between it working fine and starting up as a problem again: mail, safari and messages.
    I was convinced it was mail, as it happened this morning when I picked up my phone off the bedside table to respond to a new email.  It was working when I went to bed.  I picked up the phone when it buzzed, hit the email app, hit reply and started to type....**** bottom row wasn't working again.
    However, tonight I did 2 things....one of them worked because it went back to normal (sorry, I don't know which as I was exasperated and trying a number of things). 
    The two things I did between a broken keyboard and a working keyboard were:
    1) adding a second keyboard (English(Canada)), changing to this keyboard, and changing back
    2) disabling Siri...and then turning it back on...and then disabling Siri's "Raise to Speak"
    In retrospect, I wonder if it actually was the "Raise to Speak" that was putting the phone into a weird state, and might explain why the phone would just "suddenly" start behaving strangely when I picked it up.  Of note, the "raise to speak" hasn't actually triggered Siri to come on in months anyway.
    Regardless, the keyboard is back to normal now...and I'm just going to leave "Raise to Speak" off.  I've put the keyboard back to just "English" with no alternates and Siri remains on otherwise without issue.

  • Aligning text vertically

    I know how to center text horizontally within the text box in CS5 Extended (just click the same "center" icon you would click if you were using Microsoft Word or any other program), but how can I center it vertically (have it placed equidistant from the top and bottom of the text box)?  I know there must be a way.
    Thanks!

    I think the question has to do with text arranged vertically, rather than text that is centered on a vertical line dividing the cell.
    The example in column A is available in cells in Pages Tables. But of a kludge, though, as its achieved by inserting a return (option-return if you're typing it in the cell) after each character in the string.
    The example in column B is made by entering the text into a text box, then rotating the box using the Metrics Inspector, aand placing it in front of the cell where it is to appear.
    The example in column C has been horizontally centered in the cell using the alignment button on the format bar. There is also an alignment button in that bar to center the text vertically in the cell, but I hadn't used it before capturing the screen shot. This text also has an option return inserted after each of the first two words.
    Regards,
    Barry

  • Export vertical oriented movie single frame - not working

    Using:
    - iMac 20" 2 GHz 4 GB RAM
    - OSX10.5.8
    - iPhoto 8 version 7.1.5 (378)
    - QuickTime Player Pro Version 7.6.9 (1680.8)
    - Preview 4.2 (469.5)
    Here is what I do to export a frame from a move in iPhoto to get a single frame:
    Open and play a video in iPhoto using Quicktime Pro, stoping and selecting a particular frame, pressing Command C, open Preview, select New From Clipboard.
    or
    Open and play a video in iPhoto using Quicktime Pro, stoping and selecting a particular frame, Selecting File Export Move to Picture.
    Both the above work for horizontal oriented movies.
    However, for vertically oriented movies neigther works.
    Movies are taken with:
    - iPhone 3GS
    - Exaxti CG6
    - Insignia NS-DSC7B09
    - Fujifilm Finepix XP20.
    Any solutions/suggestions (except upgrading to the newest iPhoto, Lion, etc. too slow on a 2 GHz iMac)
    Thanks.

    I mentioned in the second part of my initial post that I did also try the export "Movie to Picture" with the same results.
    Strange! That work flow still works on my PPC platform. (Unfortunately, I don't have an Intel platform available with OS 10.5.8 installed for testing.)
    Am I able to have "MPEG Streamclip" open as the default when a movie is double clicked on in iPhoto instead of Quicktime opening the movie?
    Not sure. I don't use iPhoto (prefer Aperture) normally and definitely would not use either for video clip management. Try resetting the double-click external edit switch or reset the "Open With" atribute for the class of movies being edited.
    This actually for a novice user who I suggested take short video clips, pick a frame then copy/paste it into Preview instead of taking stills. Unfortunatly my advice fails when the iPhone photos are taken vertically.
    The problem may be based on a change on the application being use. Like anamorphic videos with contain both pixel dimensions and PAR values, the reoriented videos may contain both true orientation and display orientation information. How the files work may depend on the application being used at the time. I.e., some third-party video/still display apps rely on the original orientation while others use the "rotated" info embedded in the file. And, unfortunately, it appears that Preview does not know what to do, so it does nothing. My guess is this is a bug that needs to be reported in feedback to Apple again and again until until they decide to address and correct the Preview application.

  • Vertically Oriented Photos in Slideshow?

    Is it just me or do the slideshow widgets only accept horizontally oriented photos? When I upload a vertically oriented photo, i.e. it's taller than it is wider, the slideshow rotates it to horizontal, turning the photo sideways.
    Any way around this?
    Thank you!
    - Bob

    Really frustrated with this seeming limitation to the Muse slideshows. I've searched everywhere for an answer, or even anyone else having an issue with this. I really want vertical images to show in the slideshow. Help...?
    - Bob

  • Property for determining text frame orientation?

    Has anyone found a property to set a text frame orientation? I am writing a script in the Japanese version of InDesign to add a vertical index on the side of a page. I can do everything except set the orientation to vertical by a script. Pulling my hair out trying to determine what makes a text frame vertical...
    Leif

    Hi.
    Is what you want convert to "縦組み(tate-gumi)" text frame?
    text frame can convert like this code
    var textframe_obj;
    textframe_obj.parentStory.storyPreferences.storyOrientation = StoryHorizontalOrVertical.VERTICAL;
    var cell_obj;
    cell_obj.writingDirection = HorizontalOrVertical.VERTICAL;
    I posted blog-entry about this:
    http://www.milligramme.cc/wp/archives/570
    Thankyou
    mg.

  • HT5824 I switched over from an iPhone to a Samsung Galaxy S3 & I haven't been able to receive any text messages from iPhones. Please help with turning my iMessage completely off..

    I switched over from an iPhone to a Samsung Galaxy S3 & I haven't been able to receive any text messages from iPhones. I have no problem sending the text messages but I'm not receivng any from iPhones at all. It has been about a week now that I'm having this problem. I've already tried fixing it myself and I also went into the sprint store, they tried everything as well. My last option was to contact Apple directly. Please help with turning my iMessage completely off so that I can receive my texts.

    If you registered your iPhone with Apple using a support profile, try going to https://supportprofile.apple.com/MySupportProfile.do and unregistering it.  Also, try changing the password associated with the Apple ID that you were using for iMessage.

  • IOS 7 downloaded fine but I can't back up restored. Tried 3 times. Tried turning off iCloud. Now I can only receive texts and phone messages. I cannot make calls, retrieve phone messages or send any texts. When I try I just get a blank screen. HELP

    I initially tried to do this at 11:39pm last night. I cleaned up my apps, backed up to my computer and then took the plunge. It downloaded fine, everything went ok until I tried to restore backup. I received a message that there was an error in iTunes and iPhone could not be restored. I tried this three times giving up at 2:00 am. I tried again at 7:30am. No fix. Now I can open up phone and browse in safari. I can get notifications that a text was received or a phone message left but I can't receive or make phone calls, retrieve phone messages, or access any text features. Also I have NO purchased apps. I use my phone got work and this has ruined my day - please help!!

    I would start with going to O2 with the phone and making sure it's set up properly - maybe the SIM they gave you isn't quite right or their network isn't acknowleding it like it should.
    Seeing as you've tried restoring to factory settings and resetting network settings, I'm assuming you've tried restoring the phone as new, just to see if that helped at all. If that didn't help, you definitely need to get in touch with O2 and work things out with them.
    ~Lyssa

  • How to draw text vertically, or in an angle

    please help me how to draw text vertically, or in an angle

    I robbed the framework from Dr Las or 74phillip (don't remember which) ...
    import java.awt.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class AngleText extends JPanel {
      private int      degrees = 16;
      private JSpinner degreesSpinner;
      public AngleText () {
        setBackground ( Color.WHITE );
      }  // AngleText constructor
      protected void paintComponent ( Graphics _g ) {
        super.paintComponent ( _g );
        Graphics2D g = (Graphics2D)_g;
        g.setRenderingHint ( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
        AffineTransform at = AffineTransform.getRotateInstance ( Math.toRadians ( degrees ) );
        Font f =  g.getFont();
        g.setFont ( f.deriveFont ( at ) );
        g.drawString ( "Rotating Text!", getWidth()/2, getHeight()/2 );
        g.setRenderingHint ( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF );
      }  // paintComponent
      public JPanel getUIPanel () {
        SpinnerModel degreesModel = new SpinnerNumberModel (
                                      degrees  // initial
                                     ,0        // min
                                     ,360      // max
                                     ,2        // step
        degreesSpinner = new JSpinner ( degreesModel );
        degreesSpinner.addChangeListener ( new DegreesTracker() );
        JPanel panel = new JPanel();
        panel.add ( degreesSpinner );
        return panel;
      }  // getUIPanel
      //  DegreesTracker
      private class DegreesTracker implements ChangeListener {
        public void stateChanged ( ChangeEvent e ) {
          Integer i = (Integer)((JSpinner)e.getSource()).getValue();
          degrees   = i.intValue ();
          repaint();
      }  // DegreesTracker
      //  main
      public static void main ( String[] args ) {
        JFrame f = new JFrame ( "AngleText" );
        f.setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE );
        AngleText app = new AngleText();
        f.getContentPane().add ( app );
        f.getContentPane().add ( app.getUIPanel(), BorderLayout.SOUTH );
        f.setSize ( 200, 200 );
        f.setVisible ( true );
      }  // main
    }  // AngleText

Maybe you are looking for

  • Is it possible to "freeze" a continually refreshed workspace?

    Hello, I'm developing a project management system based on workspaces. The aim is to create and develop projects inside the workspaces, parallel to the stream LIVE, and after approvall, do the merge. I have two requirements: Req1 - Workspaces should

  • How can I listen to music through Apple TV

    receiver but still be watching TV? Whenever I switch over to "Game" which is the HDMI port for the Apple TV - I can no longer see TV - I get the Apple TV screensaver. Football! Music! What to do? thx DC

  • Recover to new disk maverick MacBook pro

    hello, i have restore my Mac from time machine to new disk (solid state 1TB), I thought of performance increase in turn it takes long time to boot system . on each reboot the system show apple logo and loading .the system comes up eventually . earlie

  • Parallel query clarification

    Hi, I am working on Oracle 10.2.0.4 2 node RAC database(Solaris 10, SPARC). I have a table containing around 10 million rows occupying 10G storage. To test the benefits of partitioning I created a partitioned table and then tried inserting all the re

  • How to run non-customised report from command prompt to gen trace file?

    Hi how to run non-customised report from command prompt to gen trace file? EBS R12 RUP6. RHEL5 rgrds