Results 1 to 3 of 3
  1. #1
    Ike
    Ike is offline Member
    Join Date
    Aug 2011
    Posts
    21
    Rep Power
    0

    Default How to position text?

    I have a JFrame with a graph in it.
    Can't figure out how to position the axis' labels (10, 20, 30...etc).

    What method for absolute text positioning?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,770
    Blog Entries
    7
    Rep Power
    21

    Default Re: How to position text?

    Quote Originally Posted by Ike View Post
    I have a JFrame with a graph in it.
    Can't figure out how to position the axis' labels (10, 20, 30...etc).

    What method for absolute text positioning?
    Read the API documentation for the Graphics class; it has a drawString( ... ) method that can do what you want.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Ike
    Ike is offline Member
    Join Date
    Aug 2011
    Posts
    21
    Rep Power
    0

    Default Re: How to position text?

    It works :) Thanx.



    Graphics2D g2 = (Graphics2D)g;
    g2.drawString(label, sx, sy);

Similar Threads

  1. cursor position in text area
    By Saran185 in forum AWT / Swing
    Replies: 1
    Last Post: 02-02-2011, 08:00 AM
  2. Change the Font Size and Text Position
    By stayfierce in forum New To Java
    Replies: 1
    Last Post: 12-03-2009, 06:17 AM
  3. get position in string from caret position
    By helloworld111 in forum AWT / Swing
    Replies: 5
    Last Post: 02-19-2009, 02:36 AM
  4. BorderFactory to set position?
    By aleplgr in forum AWT / Swing
    Replies: 2
    Last Post: 01-30-2008, 01:46 PM
  5. Help with position in java
    By fernando in forum New To Java
    Replies: 1
    Last Post: 07-31-2007, 08:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •