tags:

views:

61

answers:

2

Hi Everyone,

I want to get some examples about the GUI of an slot machine written in java, I know that it's kind of specific thing, but i want to know if it's possible to do some animations with java swing, or something like that, greetings

+1  A: 

It isn't a slot machine simulation, but you may find related features in this example.

Addendum: The example cited uses Unicode glyphs for variety, but another trick is to implement the Icon interface, which works nicely with some components. This example decorates a JButton for use in a game, while this example extends a child of JLabel to render a table.

trashgod
it's not exactly what i needed, but its a great example too, thanks!
forellana
+1  A: 

This won't answer your question exactly (because I don't have a direct example), but I hope it at least tells you that it's certainly possible.

I've done some games using Java and Swing and such. None of them have been too heavy on the animations. Most of the animations I did happened through the Java 2D Graphics libraries, while more UI stuff happened through Swing.

For example, you can take all of the functionality of a JButton, but override the paintComponent(Graphics g) method to make it look however you want. This was really useful in past projects for me.

The most graphics-intensive Swing-related game I ever built was a "Who Wants to Be a Millionaire?" game. I used animations and graphics and sounds and everything, so I can assure you that it is possible, but it certainly isn't as easy as some other libraries might be.

If you decide to pursue this, I've found that Swing Hacks has some great tips on doing weird things with Swing. Although it isn't focused on gaming, I've found enough interesting things that you can do (Drag and Drop, a bunch of weird things) to make it a worthwhile purchase.

Serplat
interesting answer, thank you!
forellana