Graphic inside a Graphic!!   (rotate string inside a graphic)

I am trying to rotate a string inside a graphic. How would i do that? I can write a string in but cannot rotate it. I used have the following:
String s = "Hello";
g2.drawString(s,
bar.x + bar.width/2 - textWidth/2,
bar.y + bar.height + textHeight + textSep);
How can i rotate "s"? Do i need graphic inside graphic?

See FAQ at
http://java.sun.com/people/linden/faq_c.html
    public void paint(Graphics g) {
        Graphics2D g2D = (Graphics2D) g;
        AffineTransform aft = new AffineTransform();
        aft.setToTranslation(100.0, 100.0);
        g2D.transform(aft);
        aft.setToRotation(Math.PI / 8.0);
        String s = "Rotated Hello World";
        for (int i = 0; i < 16; i++) {
            g2D.drawString(s, 0.0f, 0.0f);
            g2D.transform(aft);
}

Similar Messages

  • I Need an Array of Rotated String Indicators

    Greetings,
    I need to make an array containing verticle strings. The size of the array will very during runtime.
    I know that for a single string indicator I can ignore the actual control, rotate the caption and change its text property and for a cluster there's an array of references to each member which can be used for accessing the caption text of each member but it appears that all members of an array share a caption.
    Am I correct that there's no way (yet) to do that?
    Peace
    phroggie

    Hello Phrog,
    It seems like the solution proposed by Paul is sufficient for your application. But I would like to suggest an alternative solution  (with its own trade offs) that may address some of your functionality concerns. The width of a string indicator and text wrapping can both be set in the properties menu. Because of these settings, each character would appear vertically stacked. An array of these string indicators could be sized dynamically and viewed using a scroll bar. Unfortunately the letter “m” is wider than combinations of other two letters such as “is”. If the width is set too low then the letter “m” gets cutoff. If the width is set too high then smaller letters like “is” appear on the same line. There is no magic width that prevents these two cases.
    The example I have attached works around the letter “m” by appending a space between each non-m character and uses an indicator width of 23 pixels. This is enough space to display the letter “m” while the inserted spaces prevent smaller letters from appearing on the same line. Despite this inconvenience, you gain the use of built in dynamic array sizing and the horizontal  scroll bar.
    Otherwise, scroll bar functionality is not built into clusters. It is possible to implement a scroll bar for a cluster programmatically as shown in this community example: https://decibel.ni.com/content/docs/DOC-35704
    This solution isn't necessarily easy to implement, so using stacked characters in an array may be a worthwhile trade off depending on your application.
    Earl C
    Applications Engineer
    National Instruments
    Attachments:
    Vertical Strings.vi ‏14 KB

  • AffineTransform problem caused by JMenuBar + JTabbedPane

    Hello everyone.
    I am starting to think that there is a bug in Java, because otherwise what else could cause the problem I am experiencing? Namely: adding a panel with a vertical text (like a Y axis caption) using an AffineTransform (see SSCCE below) causes this text to be misplaced in some cases.
    Variant A
    Panel is added directly to the application frame. This causes no problems and everything is as it should be.
    Variant B
    Panel is placed on a tabbed pane and a menu bar is associated with the frame. The vertical text is now shifted away from the place where it should be by the height of the menu bar plus the height of tabs on the tabbed pane. Why is this happening? Am I doing something wrong?
    Moreover, when one switches to another tab and then back, the text is now shifted only by the height of the tabs. Once the application window is resized at least a bit, the text jumps right back to the position shifted by tab height plus menu bar height... Strange, strange, strange...
    SSCCE
    import java.awt.*;
    import java.awt.font.FontRenderContext;
    import java.awt.geom.*;
    import javax.swing.*;
    class MyPanel extends JPanel {
        MyPanel() {
            this.setPreferredSize(new Dimension(300, 200));
        @Override
        protected void paintComponent(Graphics g) {
            Graphics2D g2D = (Graphics2D)g;
            int g2DWidth = this.getWidth();
            int g2DHeight = this.getHeight();
            // Horizontal line in the middle of the panel (indicates the position
            // where the middle of the vertical label should be)
            g2D.drawLine(30, (int)(g2DHeight / 2), g2DWidth - 10,
                    (int)(g2DHeight / 2));
            // Vertical label
            AffineTransform origTransform = g2D.getTransform();
            AffineTransform rotate = AffineTransform.getRotateInstance(
                    -Math.PI / 2.0, 0, 0);
            g2D.setTransform(rotate);
            String text = "Centered?";
            FontRenderContext frc = g2D.getFontRenderContext();
            Font font = UIManager.getFont("Label.font");
            Rectangle2D bounds = font.getStringBounds(text, frc);
            g2D.drawString(text, -(int)((g2DHeight + bounds.getWidth()) / 2), 20);
            g2D.setTransform(origTransform);
    class Main {
        private static void createAndShowGUI() {
            // Menu bar
            JMenuBar menuBar = new JMenuBar();
            JMenu menu = new JMenu("Menu");
            JMenuItem menuItem = new JMenuItem("Menu Item");
            menu.add(menuItem);
            menuBar.add(menu);
            // Tabbed pane
            JTabbedPane tabbedPane = new JTabbedPane();
            JPanel panel = new MyPanel();
            tabbedPane.add(panel);
            JLabel label = new JLabel("Nothing interesting's going on here...");
            tabbedPane.add(label);
            // Frame
            JFrame frame = new JFrame();
            // TRICKY PART HERE =========================================
            // [(Un)comment lines as necessary]
            // Variant A: the panel only --------------------------------
            //frame.add(panel);
            // Variant B: menu bar + panel on a tabbed pane -------------
            frame.setJMenuBar(menuBar);
            frame.add(tabbedPane);
            // ==========================================================
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }Thanks for any help.
    Best regards,
    vt
    Edited by: -vt- on 23-Apr-2010 13:08

    You are ignoring the current transform on the Graphics, use the following instead of setTransform():
    g2D.rotate(-Math.PI / 2.0, 0, 0);

  • Box with a question mark inside instead of the picture or graphic

    I notice when I open i-Tunes 10.1.1 or the App Store most everywhere there are supposed to be graphics or pictures there is just a box with a question mark inside?
    I am up to date on all software, what do I need to do to get the graphics to come up?
    Thanks

    "OS X Lion includes a new feature called Lion Recovery that includes all of the tools you need to reinstall Lion, repair your disk, and even restore from a Time Machine backup without the need for optical discs."
    See: http://support.apple.com/kb/HT4718
    If this doesn't work, it is likely that your HDD has failed, or is failing.

  • Flash IDE, opaque white screen from inside a graphic object

    I'm sorry if this has been answered, I couldn't find anything about it.
    When I'm editing a graphic object on the stage (not from the library) everything else is under this opaque white screen so I can't see their true color.
    Is there a way to disable it?
    Thanks.

    No. It's a convenience feature to help you retain alignment and get sort of an onion skin idea of where you are.
    Tou can always take a screenshot and put it in a locked background layer under your clip of your content to simulate the full color. It's all about how complex you need it to be.
    If the background is animated then the good old way is the only way. Copy the frames from inside the clip (hopefully not to complex), make a new layer in the content you want to edit it in with full color, paste frames, make changes, then copy it back into your previous MovieClip.
    I myself always desire that semi-transparent white to make the clips contents obvious but I have wanted to disable that before to ink dropper select some colors.

  • Setting AFrame height to the height of a graphic inside aframe plus padding

    Hello fellows,
    I am trying to set a permanent bottom padding between an anchored frame and a graphic object (embedded Visio) that is inside the anchored frame.
    However, instead of getting that padding below the graphic, the aframe becomes really small, and only 20% of the graphic is exposed.
    The code goes like this:
    SET vFrame = vCurrentDoc.FirstGraphicInDoc;
    Loop While(vFrame)
    IF vFrame.ObjectName = 'AFrame'
    SET vFrame.AnchorType = AnchorBelow;
    SET vFrame.GraphicIsSelected = 1;
    SET vGraphic = vFrame.FirstGraphicInFrame // Select the 1st graphic in the frame
    SET vFrame.Width = vFrame.TextLoc.InTextObj.Width;
    SET vFrame.Height= vGraphic.Height + 5mm; //Here is the padding of 5mm
    Set vGraphic.LocY = 0mm;
    Set vGraphic.LocX = (vFrame.Width - vGraphic.Width) / 2;
    ENDIF
    Please, advise!
    Thank you!

    This works for me:
    // Set a variable for the active document.
    Set oDoc = ActiveDoc;
    // Set a variable for the selected anchored frame.
    Set oAFrame = oDoc.FirstSelectedGraphicInDoc;
    // Update the anchored frame's position.
    Set oAFrame.AnchorType = AnchorBelow;
    // Set the width of the anchored frame to match the containing text column.
    Set oAFrame.Width = oAFrame.TextLoc.InTextObj.Width;
    // Get the first graphic in the anchored frame.
    Set oGraphic = oAFrame.FirstGraphicInFrame;
    // Make the anchored frame's height 5 mm taller than the graphic.
    Set oAFrame.Height = oGraphic.Height + 5mm;
    // Move the graphic to the top of the anchored frame.
    Set oGraphic.LocY = 0;
    // Center the graphic horizontally in the anchored frame.
    Set oGraphic.LocX = (oAFrame.Width - oGraphic.Width) / 2;
    After you get it tested, then put it in a function:
    Set oDoc = ActiveDoc;
    Set oAFrame = FirstSelectedGraphicInDoc;
    Set iResult = AdjustAFrameAndGraphic{oAFrame};
    Function AdjustAFrameAndGraphic oAFrame
    Local oGraphic(0);
    // Update the anchored frame's position.
    Set oAFrame.AnchorType = AnchorBelow;
    // Set the width of the anchored frame to match the containing text column.
    Set oAFrame.Width = oAFrame.TextLoc.InTextObj.Width;
    // Get the first graphic in the anchored frame.
    Set oGraphic = oAFrame.FirstGraphicInFrame;
    If oGraphic
      // Make the anchored frame's height 5 mm taller than the graphic.
      Set oAFrame.Height = oGraphic.Height + 5mm;
      // Move the graphic to the top of the anchored frame.
      Set oGraphic.LocY = 0;
      // Center the graphic horizontally in the anchored frame.
      Set oGraphic.LocX = (oAFrame.Width - oGraphic.Width) / 2;
    EndIf
    EndFunc // -------------------------------------------------------------------
    -Rick

  • Cant do setColor(Color.BLACK); to a graphic object inside a class

    i have a graphic object inside a class:
    JPanel panel = new JPanel();
    Graphic lienzo = areadibujo.getGraphic();
    and then i cant do this:
    lienzo.setColor(Color.BLACK);
    netbeans error:
    <identifier> expected
    i just can do that inside a method from the class...

    HI i found the problem.
    The problem is that when i create the graphic object i do this:
    Graphics lienzo = areadibujo.getGraphics();
    areadibujo.getGraphics(); returns null so when i try to do something like lienzo.drawline(1,1,200,200); it just says nullpointer error, i guess at the time i create graphic object the panel "areadibujo" is not still created because the frame doesnt still shows, i can correct this by copying Graphics lienzo = areadibujo.getGraphics(); inside a actionperfmoded or other event method , but i dont wanna do that, where does the panel object already is created in constructor?.... i dont know if i explain my self well or how can i force areadibujo.getGraphics() to return something...

  • Draw inside movieclip/graphic with Actionscript

    Hi.
    How I can draw inside movieclip/graphic element with Actionscript?
    If i have example movieclip-element in my project and want to draw a single dot in its coordinate (10,10), how I can do that?
    ty m8s!

    The easiest way to draw inside a movieClip is the graphics class.
    You could do something like:
    this.graphics.lineStyle(1, 0x000000);
    this.graphics.moveTo(10, 10);
    this.graphics.lineTo(11, 11);
    This isn't perfect when drawing pixels, however - it only has methods for lines and shapes(circles, rectangles etc).
    If its important for you to draw a single pixel and accuracy is more important you may want to consider converting your Movieclip to a BitmapData class, which has methods for setting Pixels. Realistically though, if you didn't know about the graphics class, then that'll probably be what you're after.

  • Problems with graphics inside fax & mail form

    Hi everybody.
    I've a problem with compiling some mail forms.
    I've to load a logo inside a mail form that can be sent also as a fax.
    I tried insert a .bmp image in different ways : graphic node, intranet URL, web URL, but I have always the same problems:
    1)When I send the fax , even if the preview shows me the logo, the fax is always sent without logo.
    2) Sometimes the preview doesn't load the image.
    Somebody could help me?
    Thanks everybody
    Regards

    Hi,
    e-mail, fax or paging/SMS via SMTP configured in the SAP Web Application Server & Which prerequisites and settings are required outside the SAP system?
    Brodly there are five steps to configure
    1. Profile parameters
    2.User administration (transaction SU01)
    3. Client assignment (transaction SICF)
    4.SAPconnect administration (transaction SCOT)
    5. Settings on the mail server (SAP-external configuration)
    For step by step visit smtp configuration guide at
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/2b/d925bf4b8a11d1894c0000e8323c4f/frameset.htm.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/42/ea000fb4b31a71e10000000a422035/content.htm
    <b>Rewards point if helpfull</b>
    Thanks
    Pankaj Kumar

  • Which Adobe product is capable of this type of motion graphic? (link inside)

    We use a lot of videos at our church as a segue into sermons or series, and we would love to be able to make our own - not with film or photography, but with animated graphics. Is Flash the product I need? After Effects? A great example of the type of video/motion graphic we're looking to create is right here: 
    https://seeds.churchonthemove.com/asset/series/how-to-become-the-you
    Basically, my plan is to reactivate my lynda.com account and jump right in, but I don't want to spend time learning the wrong product. My only experience up until now has been in print and web, so the products I've spent all my time in are Illustrator, InDesign, Photoshop, and Dreamweaver. I'd like to be able to do this, too.
    Thanks!
    Ashley

    Well exactally,
    Being the economic misfortune that hit the country, my company doesn't have the funds to pay for a professional and they are trying to find a way to keep the project inside the building.
    me being 20 years old and wishing to pursue a career in graphic design sees this as a great opportunity to learn alot about printmaking as well as how to use graphic editing programs on a level higher than taught in school.
    My boss is wanting me, and going to pay for me, to go under several hours of training to accomplish what needs to be done, but like I said, I am given the task of trying to figure out what kind of software I am going to need for the task, which is why I am here asking about the programs.
    Also, it is kind of my first attempt at trying to further understand exactally what each of the programs do, and so far, I have learned quite alot by searching around and asking what other people think.
    So, If you don't find it to be too hard to put your opinions or thoughts about how I could best accomplish creating the cleanest cards I would greatly appreciate it.
    Sincerely,
    BeeHiver

  • Is there a way to place a photo/graphic inside a text box with text?

    Have a nasty pricelist to do, 200+ pages. Listings top to bottom, lines everywhere.
    I've figured out a workflow that would make my life 1000 times easier if I can do like I can do in a DIV on a website, put a photo (in this case an Illustrator file) into the background of a text box. I can then use the inset feature to push the text down off the top edge a bit, leaving the heading which are part of the Illustrator file, untouched as text flows.
    I can find nothing on a google search about doing this. It's either use 2 boxes, one graphic, one text, or not at all.
    Anyone know of a way? An Extension to ID maybe?  I'm using CC2014 mac.
    Oh ID pro's, can this be done at all?

    Bummer.
    It's a bit tricky but you could anchor the background image behind the text. So:
    An illustrator file and some text:
    Cut the background, place your cursor at the beginning of the text, and Paste:
    Open Anchored Objects Options and choose Above Line with enough negative Space after to position the background:
    The downside is it gets difficult to edit the text because the anchored image gets in the way, so you would have to use Story Editor to easily make text edits:

  • Want to put graphics inside my Text

    I want to do a traveling matte like you can do in FCP, in which I have text that's filled with an image that I have on another layer. I don't want to see the other layer as background, only inside the text. I've been playing with Primatte RT, but it doesn't seem like it's working. Anyone know how to do that. Thanks,
    Jagr

    use an image mask and drop the text into that.
    Take a look at the first part of Specialcase's tutorial
    http://www.motionsmarts.com/tutorials/reflection/reflection1.html
    Peter

  • I get no graphic when linking a website inside facebook

    <link rel="image_src" href="http://www.maxcommusa.com/images/logo1.png
    I put this inside the head of the main page but it only made the whole website left justified.
    Here is the main website http://www.maxcommusa.com
    Please help thanks! I absolutely LOVE muse.
    Anthony

    The Yahoo! Toolbar extension has been reported to cause this issue.
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    You can keep an eye on this thread:
    *[[/forums/contributors/707748]]

  • I need a great compatible graphics card for my computer. (Specs Inside)

    I have a Gateway GT5670
    # Windows Vista Home Premium (32-bit, SP1)
    # AMD Phenom 8400 Triple-Core Processor 2.1GHz (3MB L3 Cache, 3600Mhz Bus)
    # NVIDIA 6150SE Integrated Graphics with up to 128MB shared memory
    # 3GB DDR2 Memory (2 x 1GB, 2 x 512MB, up to 4GB)
    # 320GB 7200rpm Western Digital Hard Drive
    # 8-Channel (7.1) Integrated High Definition Audio
    # DVD Burner 18X Max with LabelFlash
    # 15-1 Media Card Reader
    # 56k PCI Data/Fax Modem
    # USB Powered Stereo Speakers
    # Dimensions (WxDxH): 15.6" x 7.2" x 16.10"
    # Weight: 23.4lbs
    # 300W Power Supply
    And
    * One 5.25” external drive bay (DVD-Burner, Blu-Ray Drive, etc)
    * One 3.5” internal drive bay (additional hard drive)
    * One 16x PCI-e expansion slot (Video Card)
    * Two 1x PCI-e expansion slots (Sound card, TV-Tuner, etc)
    Thanks and can Best Buy install graphic cards for me?

    It also depends on the voltage rails (12v and 5v I believe) If you have a weaker number, some of these cards can make toast of the computer in no time!
    *******DISCLAIMER********
    I am not an employee of BBY in any shape or form. All information presented in my replies or postings is my own opinion. It is up to you , the end user to determine the ultimate validity of any information presented on these forums.

  • Graphics inside my Web Application

    Hi everyone, I'm working on an application that needs to generate graphics as a results of some information that is introduced by the users... I'm working with JSF so I don't know if anyone could tell me what should i use to generate this graphics and how to use it....
    Thanks in advanced, Andreina

    Perhaps this canvas component may be of some use:
    http://www.manorrock.com/products/jsf/index.html

Maybe you are looking for

  • How to change your type of ipod in itunes

    How can you change your type of ipod in itunes.  We purchased a new Ipod touch and the computer/itunes will not reconize it.

  • Group Skype on Samsung Smart TV's. Does it work?

    I have a 65" Samsun Smart TV with a Logitek HD Skype TV Camera.  The TV has a app for skype but I cant see how you do Group calling thru my Smart TV.   Is it available on the Samsung Apps? If not, when will it be available?   I can do Group Skype thr

  • Missing Button Graphics (E.g. Search/Submit type buttons)

    Hi, This problem has plagued me for a while now and I've made a few attempts at finding a solution but none have worked. Basically in place of the 'Post Question' button below which should be in green I have a 'place holder' grey button with the word

  • Can I switch on ACD 23" without connecting it to laptop at all?

    I've just now bought an Apple Cinema Display 23" and I connected it to power source via power brick. It is not yet connected to the laptop (DVI socket) as I dont have a DVI to Mini-DVI adapter which I've just ordered. I was expecting the LED light on

  • My firewire port works with ext hd but not with audio interface

    2010 Imac 21.5 running 10.8.5. My firewire port works with ext hd but not with audio interface. The local authorized Apple tech said that I need a new motherboard, but my firewire ext drive works perfectly. I don't understand. Thanks.