Results 1 to 8 of 8
- 03-04-2012, 08:20 AM #1
Member
- Join Date
- Jan 2012
- Posts
- 21
- Rep Power
- 0
getting specific information from the array list
hi it is me again my question now is that my professor ask me to store 4 different x and y values in an array list and i did in this way
now my problem is that i need to get the individual x or y coordinates to be able to draw some circles but i do not know hot to extract the x and y coord from the array list to use it later?? help pleaseJava Code:private void createTargets() { double ax = 125; double ay = 175; double aradius = 7; String input = JOptionPane.showInputDialog("Type an integer" + " between 2 and 5"); int number = Integer.parseInt(input); for(int i = 0; i < number; i++) { Target targ = new Target(ax, ay, aradius); targets.add(targ); Random rand = new Random(); ax = rand.nextInt(300) + 10; } }
- 03-04-2012, 12:05 PM #2
Re: getting specific information from the array list
Do you know how to get a Target from the ArrayList?
Do you know how to get individual x or y coordinates from a Target?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 03-04-2012, 12:41 PM #3
Member
- Join Date
- Jan 2012
- Posts
- 21
- Rep Power
- 0
Re: getting specific information from the array list
I know that with an for each loop you can and a println() I can pt what I have in my array list... Individual x and Y yes you use tg or any target object name dot .getY() or getX() but I still do not know how to extraxt that to create my circles maybe it is easy but I am stuck
- 03-04-2012, 10:34 PM #4
Re: getting specific information from the array list
You can what?I can pt what I have in my array list
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 03-05-2012, 12:07 AM #5
Member
- Join Date
- Jan 2012
- Posts
- 21
- Rep Power
- 0
Re: getting specific information from the array list
pt means i can print what i have in my array list
- 03-05-2012, 11:17 AM #6
Re: getting specific information from the array list
Not in any language I know. Please go through this.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 03-05-2012, 11:47 AM #7
Member
- Join Date
- Jan 2012
- Posts
- 21
- Rep Power
- 0
Re: getting specific information from the array list
I mistyped
- 03-05-2012, 12:40 PM #8
Senior Member
- Join Date
- Aug 2008
- Location
- Stockholm, Sweden
- Posts
- 119
- Rep Power
- 0
Re: getting specific information from the array list
"pt" is not a mistype. "pritn" is a mistype. Did you also just "miss" proper punctuation and capitalizing as well?
A lot of users on these (and other) forums won't bother with answering question if you don't appear to have put any kind of effort into it.
Similar Threads
-
Compile Array information
By viviosoft in forum AndroidReplies: 3Last Post: 09-09-2011, 11:57 PM -
Linked List, Array List time complexity
By Rick99771977 in forum New To JavaReplies: 4Last Post: 08-18-2011, 05:37 AM -
array with specific needs
By BeginnerProgrammer in forum Java AppletsReplies: 9Last Post: 06-21-2011, 03:14 AM -
Getting specific hash in a 2D-Array
By benn22 in forum New To JavaReplies: 0Last Post: 03-18-2011, 07:24 AM -
How would you get information from a file and then store it in an array?
By szimme101 in forum Advanced JavaReplies: 3Last Post: 04-07-2008, 06:02 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks