Hello, I have to make some applets for school with a dice. If the comuter makes me a number with math.random I want to show a picture of a dice with that number of dots on it. but I don't know how to work with a Switch statement. and where I have to put them in my applet?( under the init() stuff or where else?) So I would appreciate it if you would help me. Thijs Haitjema email@example.com
Hi, Welcome to JavaRanch! Sun's online Java Tutorial has a section on applets which would help you understand how applets are put together, and what the "init" and "start" methods are for. As far as random numbers goes, to get a random number from 0 to 5, inclusive (six different possibilities), you could use the java.util.Random class:
You could then use this number as an index into an array of Image objects.