Im trying to create a program which acts like a fruit machine at the moment i am writing an action listener to work with the spin JButton. i have a number of IconImages constructed. could i possibly set these images as an array and then use the random int method to show a random image? if so how do i go about that?
Jump to Post
The first 6 errors are because you are trying to store icons of type ImageIcon in an int array. You need an ImageIcon array.
The other 3 errors are because fruit1, fruit2 and fruit3 are local variables that exist only while the fm1 constructor is active. Since you want …
All 4 Replies
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.