tiled images in swing

Posted by sasquatch90 on Stack Overflow See other posts from Stack Overflow or by sasquatch90
Published on 2010-05-07T20:11:12Z Indexed on 2010/05/07 20:18 UTC
Read the original article Hit count: 192

Filed under:
|
|
|
|

I have task to prepare two windows with swing. One contains grid of squares, with random numbers in them. In second I need to load pieces of tiled image and then show them in the correct order, forming tiled image.

Windows should look like this :

http://img535.imageshack.us/img535/3129/lab8a.jpg

Okay so how to bite this ? I've used swing only few times to draw some 2d polylines, so basically I just theoretically now what to do. Ok, so window number 1: I start with creating Jframe for the window. Then I do for loop and in it create 16 JLabels with random numbers in them ? How to set margins between each tile and the whole window ?

Window number 2 : So I start the same, but instead of loading numbers I add images ? Now, how can I load image from file and then set it as background ?

© Stack Overflow or respective owner

Related posts about java

Related posts about swing