Results 1 to 3 of 3

Thread: Beginner Java Student Needs Some Help

  1. #1
    NOMADMAN
    Guest

    Beginner Java Student Needs Some Help

    I have this snippit

    VB Code:
    1. for (int i=1; i<=4; i++) {
    2.             for (int j=1; j<=5; j++) {
    3.                 g.drawString( dSales[i][j], ((100 * j) + 20), ((15 * i) + 17) );
    4.             }
    5.         }

    its not working i get:

    D:\jdk1.3.1\bin>javac DailySales.java
    DailySales.java:70: cannot resolve symbol
    symbol : method drawString (double,int,int)
    location: class java.awt.Graphics
    g.drawString( dSales[i][j], ((100 * j) + 20), ((
    15 * i) + 17) );
    ^
    1 error

    Can I just not draw a double in with drawString? If not how can I convert to string from double?

    P.S. The pointer (^) in the compiler is pointing to the dot between g and drawString!

    THANKS
    NOMAD!

  2. #2
    NOMADMAN
    Guest
    SORRY FOR THE POST, I GOT IT TO WORK!

    but an explanation would be nice, I added "" to dSales[i][j] in the drawstring line. Y?!?! does it convert to string cause the ""??? THATS MAJOR RETARDED!

  3. #3
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604
    you would have to use something like parseInt to convert the string to an Int, and then cast the int to a double, but i am not sure on the code for that exactly, but that is the principle behind it

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

Posting Permissions

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



Click Here to Expand Forum to Full Width