Results 1 to 3 of 3
  1. #1
    MartyP is offline Member
    Join Date
    Mar 2011
    Posts
    10
    Rep Power
    0

    Default Draw integers like strings

    Dear forum,

    I have a short question: is it possible to draw an integer directly, so not like this:
    Java Code:
    	    	        String drawString = ""+133;
    	    	        g.drawString(drawString, xloc, yloc);
    but more like

    Java Code:
    	    	        g.drawString("133", xloc, yloc);
    where "133" is a variable integer.

  2. #2
    dswastik is offline Senior Member
    Join Date
    Dec 2008
    Location
    Kolkata
    Posts
    283
    Rep Power
    7

    Default

    String.valueOf(variableInteger)
    Swastik

  3. #3
    lovelesh is offline Senior Member
    Join Date
    Nov 2010
    Location
    Delhi
    Posts
    135
    Blog Entries
    1
    Rep Power
    0

    Smile

    Quote Originally Posted by dswastik View Post
    String.valueOf(variableInteger)
    This is the best solution!

    you can do it like this as well
    Java Code:
    g.drawString("" + <int var>, xloc, yloc);

Similar Threads

  1. switch case with integers and strings...
    By JavaComplient in forum New To Java
    Replies: 2
    Last Post: 10-21-2010, 07:52 AM
  2. Combining strings and integers into collection
    By neilvb in forum New To Java
    Replies: 2
    Last Post: 10-05-2010, 11:23 PM
  3. Set of Integers
    By rsjava24 in forum New To Java
    Replies: 7
    Last Post: 01-28-2010, 11:29 AM
  4. Finding Strings, booleans and Integers
    By Pez in forum SWT / JFace
    Replies: 1
    Last Post: 07-19-2009, 03:24 PM
  5. Replies: 7
    Last Post: 04-28-2008, 05:28 AM

Posting Permissions

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