开发者

Creating GUI for Bantumi game

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜