-3

I am really new In Java Gui , and at our University we have a project which we should make Gui Risk game , but i am having some troubles about the gui part , basically what i am trying to do is to create a world with continents and cities , but i cant really find a way to make cities , first i taught i would draw every city with Inkscape and make buttons with those png files , but as i said i am extremely new with gui so if anyone can give me some ideas about best ways to create my map and also why you think it is the best way it would be really awesome... open for every kind of ideas

My map should look something like this at the end and i should be able to click every city in order to play:

http://i.imgur.com/AH3rB1M.jpg

camickr
  • 321,443
  • 19
  • 166
  • 288
cagince_
  • 3
  • 5

1 Answers1

3

First, you create a drawing panel by extending a JPanel. You draw the world map on your drawing panel.

You define a List of City instances in your GUI model. One of the fields in the City class is the coordinates of the city on the word map, using a java.awt.Point instance. You need the coordinates to draw a circle for the city in the correct location.

You define a MouseListener that listens for mouseReleased events on the drawing panel.

If a left mouse button is released within 6 pixels of one of your City coordinates, the player is selecting that city.

Gilbert Le Blanc
  • 50,182
  • 6
  • 67
  • 111