Results 1 to 2 of 2
  1. #1
    Java Junior is offline Member
    Join Date
    Mar 2012
    Rep Power

    Default g.drawArrayList?

    Hey guys, I have an empty arrayList and the user can type into the textfield a word, click the add word button and the word will be added to an ArrayList. My problem is that I need to make it so when they press another button the list of words will be draw to the centre of the applet.

    I can do this for example.

    Java Code:
    String s = "banana";
    the in my paint method I can say

    Java Code:
    g.drawString(s, xPos, yPos);
    but how do I do the same thing but with an arrayList? My arrayList?

    Java Code:
    al = new ArrayList();
    Java Code:
    g.draw(al, xPos, yPos); //doesn't work.
    also I'd rather the arrayList be printed starting at the top left going downwards.

    Please try to not just refer me to a generic page because I've looked through the articles already. Didn't find anything about drawing the contents of an array.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: g.drawArrayList?

    Do you know how to iterate over a List?

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Posting Permissions

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