mardi 31 mars 2015

automatic picture size Java

everyone, I'm doing a project of Snakes and Ladders, I have everything ready only with console for now but I have to implement a graphics interface.


My program generates a 10 by 10 matrix and is filled with snakes and ladders randomly. Five of each. It's all fine when you're doing it in console because you just need to print the beginning and the end with text.


Now my problem is that I want to create a JFrame with the 100 squares(I plan to do this with images, one for each square and organize it inside a panel with gridlayout), and as the snakes and ladders are randomly created I want to know if there's a way to, for example, knowing that my snakes begins in square 60 and ends in square 32, to automate that my snake appears in that space?


I guess I have to create the images of different lenghts of snakes and ladders, but how to I make them fit in the space I need them? Thank you.


Edit If you need the source code, please tell me.


Aucun commentaire:

Enregistrer un commentaire