Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a Interactive GUI for a java game

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

like image 755
Gareth Avatar asked Jul 03 '26 04:07

Gareth


1 Answers

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.

like image 130
Stealth Rabbi Avatar answered Jul 05 '26 16:07

Stealth Rabbi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!