Creating a Interactive GUI for a java game

Gareth picture Gareth · Sep 26, 2011 · Viewed 27k times · Source

Hey guys I'm creating a game similar to farmville in java and I'm just wondering how would I implement the interactive objects/buttons that the user would usually click to interact with the game client.

I do not want to use the swing library (generic windows looky likey objects), I would like to import custom images for my buttons and assign button like properties to those images which would be used for the GUI.

Any advice? Any pointers? I can't seem to find that information through youtube or some other java gaming sites as they're only showing simple example using swing.

Any help would be deeply appreciated thanks!

Regards Gareth

Answer

Stealth Rabbi picture Stealth Rabbi · Sep 26, 2011

Do you really not want to use Swing, or do you just not want the default look and feel of a JButton and other swing controls? What does " (generic windows looky likey objects), " mean?

There are many sources out there that describe customizing buttons to include images on top of them: Creating a custom button in Java

JButton and other controls have all the events and methods associated with adding click listeners, etc. You probably don't want to create your own control. We do not have enough information to go off of, for example what does "interactive objects" mean?

If you simply want to add an icon to a JButton, use the constructor that takes an Icon.