Probing the color (read byte value) of some image would be one solution. The other would be to use polygons to describe the field borders and then iterate a list of polygon objects, testing whether they contain the click position.
That’s not as fast as the bitmap solution, but it should be fast enough for your purpose and you could easily add a “map editor” to your game to let the user create custom maps by providing the borders.
I think, the original Risk has ~50 fields, a loop like
Polygon[] fieldBorders;
for (int i = 0; i <fieldBorders.length; i++) {
if (fieldBorders[i].contains(mouseX, mouseY))
return i;
}
}
should be fast enough. If not, you could make use of the fact that countries are grouped by continent and check for the continents first. This should reduce the test to 6 continents and ~10 fields. However, I don’t think this would be necessary.
The polygon solution has one additional advantage. You could easily highlight the field under the mouse and/or the field the user clicked.
If you have an image as map because that looks better, you can still draw a polygon over that image, using a translucent color, for example new Color(255, 255, 0, 128)
.