Positioning text

Hi,
People on this forum have told me not to actually set the transform on the Graphics2D transform, but to use the createTransformedShape method to transform the shape prior to drawing it.
Thus not ...
g2d.setTransform(aT);
g2d.draw(line);
... but ...
g2d.draw(affineTransform_.createTransformedShape(line));
This works fine, as long as I use GeneralPath objects ("line" in the above example), which is what I use most of the time. But now I need to annotate my lines with text, and I get stuck.
Say I want to put the text "Monkey" , which is at position x=4, y=200 in userspace. Normal font is fine. How do I do that? g2d.drawString("Monkey",4,200) does not work as it puts it in device space. What do I do? I looked at font.deriveFont(aT), but I am unsure what this does/is supposed to do.
Cheers - Michel - Spain.

Thanx. I am a bit further now, but ... I still can't get it to work. This is what I did after your reply:
String text = new String("Monkey");
Shape s = g2d.getFont().createGlyphVector(g2d.getFontRenderContext(), text.toCharArray()).getOutline(xPosn,(zMin+zMax)/2);
g2d.draw(affineTransform_.createTransformedShape(s));
Now, at the right place, I get 'something', but it looks awful: way too long in the x-direction, and way too small in the z-direction. That is probably because my affineTransform_ increases the user units in the x-direction, but reduces it in the y-direction.
So what do I do??
I'd appreciate your help.
Cheers - Michel - Spain

Similar Messages

  • How can I position text vertically in a Numbers spreadsheet cell?

    Hi,
    I would like to position text in a series of Numbers cells in a vertical direction to reduce the width of the spreadsheet.  I can't find a way of doing this using the inspector or fonts panels?  Can anyone suggest a solution?
    Thanks in advance

    Is it so tiring to use the Search tool before asking a question ?
    Yours was asked and responded many times.
    Sometimes I wonder if I'm right when I think that human brain is more efficient than computers.
    These dumb machines are able to search by themselves and give links to some existing answers in the "More Like This" box !
    Yvan KOENIG (VALLAURIS, France) mardi 17 mai 2011 17:39:25

  • Position text  filled at new PR document

    Hello,
    I have a strange problem in production.
    When we start a new PR me51n,  filed the first position (10), the position text is automatically filled whit a default text, that the user must delete every time.  This problem is appearing only in production ( in test/ integration is not ). Also this is happening only for position 10, for all other no.
    I have checked the user exits, and that filed is not touched by any of those implemented.
    Have you encounter this situation before ?
    Regards,
    Adrian

    When typing or pasting, that's the way it works unless you have Smart Text Reflow enabled (I can't stand it so I leave it off). The text that does not fit is called "overset" and is inidacted by a red plus sign in the Out Port of the text frame. If you click the plus sign with the selection tool it will pick up the overset and you can place it into an new frame (which will be threaded to the original). Holding the shift key when placing the text will flow all that there is, making new frames and pages as required to accomodate it.
    This is basic function of the program. You should spend some time reading the help files on working with text, or pick up a good beginners's book, like Sandy Cohen's Visual Quickstart Guide to InDesign.

  • Positioning text in SAPscript

    Hello, is there any possibilities to positioning text in a SAPscript. I would like to determine x and y coordinates where to start the writing out. It is working in the case of boxes, but what if I want to write normal text to a certain position. How could I do that?

    Hi Jakob,
    Yes, You can position text in a SAP Script using <b>POSITION</b> command by specifying its attributes like X Origin, Y Origin and Window.
    You can ONLY position texts with in Windows only.
    Syntax:
    <b>/: POSITION [X Origin] [Y Origin] [Window] [Page]</b>
    X & Y - Sets the origin for x 7 y parameters for the box command.
    Window - Sets the default values for the left and upper edges.
    Pages - Sets the values for the left and upper edges of the current page.
    Basically used to set default setting for the box command.
    /: Position x Origin ‘1.5’ cm y origin ‘1’ cm
    Thanks,
    Vinay

  • Default text in me51n - line position text

    Hello,
    I have a strange problem in production.
    When we start a new PR me51n, filed the first position (10), the position text is automatically filled whit a default text, that the user must delete every time. This problem is appearing only in production ( in test/ integration is not ). Also this is happening only for position 10, for all other no.
    I have checked the user exits, and that filed is not touched by any of those implemented.
    Have you encounter this situation before ?
    Regards,
    Adrian

    Hi
    Check if the BADI ME_PROCESS_REQ_CUST is working in your system, surely method PROCESS_ITEM. If it's true check if you have this interface in the coding:
    Interface: IF_PURCHASE_REQUISITION_ITEM
    Possible methods:
    IF_LONGTEXTS_MM~GET_TEXTOBJECT
    IF_LONGTEXTS_MM~GET_TYPES
    IF_LONGTEXTS_MM~GET_TEXT
    IF_LONGTEXTS_MM~SET_TEXT
    IF_LONGTEXTS_MM~ADOPT_TEXT
    IF_LONGTEXTS_MM~DELETE_TEXT
    IF_LONGTEXTS_MM~EDIT_TEXT
    I hope this helps you
    Regards
    Eduardo

  • Having trouble positioning text

    http://kurtesposito.com/contact.htm
    Looking for some help on how to position this text on this page. Not sure what I'm doing wrong. Also looking for helping on that horizontal strip of white running along the top of my image.
    Thanks

    You have some errors.
    Line 136, you are attempting to merge html and css...
    <img src="images/hurtlogo_original.png" height="80" width="329" float=left />
    float=left is not valid html or css. If you want the image floated left, you need to put it in a style attribute and format it as css...
    <img src="images/hurtlogo_original.png" height="80" width="329" style="float;left;" />
    You also have several line items (the <li> tags around line 139) that are not properly contained within a <ul> or <ol> tagset...
    <div id="nav">
    <ul>
    <li><a href="index.htm">Home</a></li><li><a href="about.htm">About</a></li><li><a href="portfolio.htm">Portfolio</a></li><li><a href="http://kurtesposito.com/blog/">Blog</a></li><li><a href="contact.htm">Contact</a></li>
    </ul>
    </div>
    As far as your original issue, not knowing how to position text, did you have some more information on what you wanted to do?
    I'm also not seeing white space with your image (I assume you mean the KurtLogo?).

  • Position text very close to a surrounding border

    I am looking for a way to position text very close to the surrounding border of a table in an RTF template.
    A way of achieving this using standard Word functionality is to place the table with its borders in a header with a fixed placement on the page, and then place the text in another table with the same, fixed placement, in the normal part of the document. When such two parts of a document are processed by Word, the text can e.g. be placed 1 pixel from the bottom border which is normally not possible as Word will always make room for the descender of the font.
    However, when I try using the same trick in BI Publisher, it does not work, as BI Publisher always places the text of the document below the text of the header. BI Publisher does not allow the text to overlap.
    Is there a way of achieving this overlap between a page header and the normal text in BI Publisher?
    Or does anybody know of a different solution to the problem of placing text very close to the bottom border of a table cell?
    Best regards,
    Jan

    Pass me the template and xml, alonw with some xplanation and possibly with expected output.
    check in profile to get id.

  • Employee Position Text

    Dear Friends,
    I am New to HR ABAP. Can any one help me, which table the Employee Position Text will be.
    Thanks &#38; Regards,
    Sanjeev

    check tables HRP1000( with object types as "S") or PA0001 if there is integration between PA and OM
    if there is no integration between OM and PA (ie if you dont use OM ) check tables
    T528B     -                     Positions
    T528T                          Position Texts
    Edited by: Anantha Prakash on Jan 29, 2008 10:42 AM

  • How to get position texts

    Hi,
    I am retreiving positions texts for the positions existing in infotype it0001 using table T528T.  But the table T528T only display the position text for the first 25 characters. Could any one tell me how can i get the complete text for the position, please suggest if any function module exists.

    Hi Phani,
    Use RH_OBJECT_TEXT function module with PLVAR = 01, OTYPE = S (position), OBJID = position ID, BEGDA = sy-datum, ENDDA = sy-datum.
    Use returning field DISPLAY_TEXT.
    Regards,
    Dilek

  • Is it possible to position text i am entering into a pdf with reader ?

    i scanned a form, in which i want to enter text
    with adobe reader, when i select the add text tool button, i can click on the pdf and type in text, presumably in a text box
    but when i want to reposition this text box afterwards ( will need to do this for each entry to make look neat ), i cannot select the text box to reposition
    the box with the handles appears for a second, but not long enough for me to drag into position
    can you assist ?
    thanks
    hard to imagine ability to enter text is there without the ability to position the text

    The text box initially created is there
    But I cannot seem to select it to drag to a new position
    Any ideas?

  • How to position text in a window in sap script

    Hi all,
    I have a sapscript and in the main window of that, i have created 2 boxes. Now some line items get printed in the first box. But my query is about putting some text in the second box. How to put text at a certain position in a window in sapscript ??

    Hi ,
    If the Created boxes are side by side, use Tab or paragraph format (right aligned). If the second box is at the bottom of the main window use new-line command and create a text element and all the same using print program
    Regards,
    Chandra

  • Upload positions-text in different languages?

    Hi folks,
    we have to enter positions in different languages. To enter new positions we use a flexible upload - method. We have got one upload-file for EN and another one for DE.
    The problem:
    if we upload the EN-file, the text of the positions in DE gets blank,
    if we upload the DE-file then, the text of the positions in EN is blank.
    So one of the fields (either DE or EN) is empty and would have to be entered manually.
    What can we do to upload both DE and EN - text for the positions?
    Is this possible at all?
    Thanks for your help,
    Thomas

    Hello folks,
    it´s possible to upload different languages!
    It´s easy if you know how to do it:
    create an upload-method with (at least)
    Positionplan and language in the header
    Position-nr and text (short, medium, long if you want) in the body
    --> NO further information (hierarchy, type or whatsoever)!
    Create a file with information above
    Import the file
    --> if positions are available the new language will be filled in
    --> if you accidently address a new position you will get an upload error (as no hierarchy-info is available).
    Hope this will help others as well,
    Thomas Kejik :-)
    PS: special thanks to Tanja Ritter who provided this trick.

  • Position text box  in centre part of region

    Hi
    I want to position of componentes (text box, buttons, combo box) in region at center.
    i.e if i have region having only two text boxes and i want to put it in centre part of form/region.
    How it can be done, do i need to write any code or from APEX it can be done?
    Thanks in advance

    For information, <center> tag is deprecated.
    Use <div align="center">...</div>or CSS (text-align, margin, etc...) instead.
    Yann.

  • How to generate formated (defined position) text and image using pl/sql and

    Hello,
    I need to use pl/sql to create a dynamic html page (or image , if possible) with defined positions for text and bar code. It is necessary because the page will be printed and it should be able to be read by one other process , OCR, that needs to have all the data in defined positions.
    Any suggestion are welcome.
    Thanks in advance,
    Emilio

    I don't think it's that easy. Notice that if you put the insert into an actual pl/sql block, you don't get the correct column pointer anymore.
    BEGIN insert into bob(col1, col2) values (123.12, 12345.12); END;
    ERROR at line 1:
    ORA-01438: value larger than specified precision allows for this column
    ORA-06512: at line 1
    Richard

  • Simple layout issue: positioning text atop a JButton image

    (I apologize for the cross-post; I assumed that this forum was for relatively advanced Swing topics, and therefore initially posted this question in the "New to Java Technology" forum.)
    I've got a newbie Swing problem that I just can't seem to figure out. Basically, I'd like to place text for a JButton in a certain location within the image I'm using for the button. If I use the following code:
    String buttonText = MyStringFactory.getString();
    JButton myButton = new JButton(buttonText, new ImageIcon("myimage.png"));
    myButton.setHorizontalTextPosition(SwingConstants.CENTER);
    myButton.setVerticalTextPosition(SwingConstants.CENTER);The text will display within the button, but it will be exactly centered atop the image. What I'd like is to have the text displayed on top of the image, but to be left-aligned. So, instead of:
    |        Test        |
    ----------------------I want:
    | Test               |
    ----------------------Where the image behind the word "Test" is the image specified when I created the myButton JButton object. The string can be of varying length and must support various fonts (i.e., simply using a monospaced font and padding on the right-side of the string with spaces isn't an option). In more explicit terms, what I want is a way to center the text vertically with respect to the background image, and place it (the text) X pixels from the left-hand side of the background image.
    I've looked at using OverlayLayout to solve this problem, creating a JButton and a JLabel and placing them both within a JPanel. However, when I do this, the JLabel is always rendered behind the JButton, so I can't see it. Is there any way to specify the z-ordering of objects in a JPanel when using OverlayLayout?
    Or is there a much simpler solution to this (seemingly) simple problem?
    Thanks in advance for any assistance!

    hello guy,
    well, you seem to want your text to be in a very specific position since you mention x pixels.
    i don't think you can tell a JButton where exactly to draw the text and icon.
    if you want to do that, you'll have to create you own button.
    something like that:
    class CustomButton extends JButton {
    String text;
    ImageIcon icon;
    public CustomButton(String text, ImageIcon icon) {
    // only use the default constructor of the JButton
    // and save the text and icon separately
    super();
    this.text = text;
    this.icon = icon;
    // set some preferred size so that the layout
    // manager has some idea of how big your button will be
    this.setPreferredSize(new Dimension(
    icon.getIconWidth(),
    2*icon.getIconHeight()));
    // override paintComponent()
    public void paintComponent(Graphics g) {
    // first call this method in the super class
    // this will draw your button color, outline, borders..
    super.paintComponent(g);
    // now draw your icon whereever you want it on
    // your button
    g.drawImage(icon.getImage(),5,
    getHeight()/2-icon.getIconHeight()/2,null,this);
    // and draw your string.
    // using FontMetrics to get the dimensions of your
    // string will allow it to be independent of
    // font type and size
    g.drawString(text, icon.getIconWidth()+10,
    getHeight()/2+g.getFontMetrics().getAscent()/2);
    hope that helps a bit :)
    cheers, alex.

  • Positioning text within block

    Hi
    I am wanting to postion text within a Box/block, these are list items that I have used as navigation buttons.
    I have set the box size and have selected "center" for text positioning, this positions the text in the centre horizontally ok.
    I would like to know how to position the text centrally verticially aswell?
    Many thanks
    Mark

    Hi
    Thanks for quick answer.
    I can get the padding within a div option to work, but one of the List  items/ button texts needs different padding to the others because it is two lines of text.
    Can I differentiate the treatment of one "Li" ??
    Cheers
    Mark

Maybe you are looking for