开发者

Creating GUI for Bantumi game

开发者 https://www.devze.com 2022-12-31 03:45 出处:网络
I\'ve written backend for simple Bantumi game. Now I\'d like to create a simple GUI for it, so that it would look like this :

I've written backend for simple Bantumi game. Now I'd like to create a simple GUI for it, so that it would look like this :

Creating GUI for Bantumi game

How to start ? What layout should I use, and what type of compone开发者_如何学Gont each element should be? Classes :

Basket

Player

Game

Main

Shared


For the layout, I would suggest that you have an outer JPanel that used something like a BorderLayout. It would contain the two end baskets and in the cetner another JPanel that employs a GridLayout to hold all of the playing baskets.

As for the classes, it looks like your Main class is superfluous - you can just put the main method in your Game class and call that. The Shared class and the Player class do not need to be represented as GUI classes, so they can remain as is. I would suggest that you have your Basket method extend JPanel and override the paintComponent() method to allow for custom painting of the beans. You have a choice with Game, you could make it extend JFrame or have it contain a JFrame.


If you want it to be online game you can look at JavaScript canvas or Flash. Of course you can also create Java applet that uses something like combination of Swing and Java 2d

0

精彩评论

暂无评论...
验证码 换一张
取 消