This site requires JavaScript, please enable it in your browser!
Greenfoot_back
Back to discussions
Dubstep_thumb
JayWood860 wrote ...

2012/5/17

Lists

Dubstep JayWood860

2012/5/17

I'm just learning how to work with lists and i've create one perfectly fine. Now i'm just wondering how you can add this list to the world. i know you can't just set the actor's image to the list, so how can i add this to the world. also, is there a difference between "java.awt.List" and "java.util.List"? Thanks for all the help!
Dubstep_thumb JayWood860

2012/5/18

anyone?
Smalldav davmac

2012/5/18

If you want to display a list of items in your scenario, both java.awt.List and java.util.List are wrong. (What do you mean by "I've created one" - why would you create something if you don't understand what it does?) There are various scenarios which do have examples of how to show lists of items - just do a search for "gui"
Dubstep JayWood860

2012/5/18

i do understand what a list is. this is what i have so far:
as you can see i did create a list, whether or not it's in the right format or not i don't know. but how would i display it in the world. i would like the lists to look something like this: (just with my own strings instead of course). but i will now search for "gui"
Dubstep_thumb JayWood860

2012/5/18

*getWorld().addObject(....);
Smalldav davmac

2012/5/18

As I said, you can't use java.awt.List to display something in the world. Do a serach for "gui" to find scenarios with list components.
Fractal_r3800c0s800f10000t0z80x0y0 danpost

2012/5/19

A list is an object, yes; but, it is an abstract object and cannot be displayed as such. Really all you have are a bunch of String object (which also are abstract). What needs done is to create objects to draw the strings on and display them, which you can accomplish by way of a list component gui or by coding it yourself (I prefer to code things myself, as then I am not restricted in any way as to how to do things and what can be done. The drawback to this, though, is the time factor. On the plus side, however, is the experience of the journey to accomplish this task; the knowledge acquired through the journey; and the satisfaction, when completed).
You need to login to post a reply