hello,
i am working on an ongoing program and at this stage i need to implement something like an array list. This is what i want to do.
1) Create a maximum number of squares.
eg Final int maxSq = 12;
2) Create an empty array list.
3) based on a choice, add 12 textAreas to array list.
problem 1: i seem unable to create a list with existing textAreas.
4) choose a random textArea from the list.
5) change color to blue
6) remove item from list.
(this process requires a simple loop where
for (int currentSq = 0 ; currentSq < maxSq ; currentSq++){
**code to add item to list;randomly select;remove item;}
Currently a lot of is theory and im trying to figure out how to do this. My research has suggested array lists, although i have seen linked list mentioned. However, examples i find of lists are like this:
int[] array = { 1, 2, 3, 4, 5 };
or
String array = { "1", "2", "3" }:
i realise that "int" is a number, and "String" is text. But i am unsure how to use existing objects eg jtextArea1, jtextArea2, etc. as it states that jTextArea cant be used (incompatable types). Also, when attempting to add items to a list, my "code" is unrecognised.
eg int[]
test = {};
test.add {1};
test.add {2};
im sure this is a syntax problem. So does anyone know of an idiots example anywhere? the books i have dont give me what i need.
thankyou,
joseph
[ February 25, 2005: Message edited by: joseph mcgratton ]