I noticed in a code example that I ran across that people were using Swing to load textures. If you really want to ditch the windowing tookit as a dependency you can't utilize javax.swing.* in your operations.
Below is a method for loading images which utilizes something that's guaranteed to be in JDK1.4 runtime and doesn't have any (obvious) dependencies on the swing architecture (and is cleaner code to boot).
1 2 3 4 5 6 7 8 9 10 11 12
| BufferedImage bufferedImage = ImageIO.read( new File( fileName ));
AffineTransform tx = AffineTransform.getScaleInstance(1, -1); tx.translate(0, -bufferedImage.getHeight(null)); AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); bufferedImage = op.filter(bufferedImage, null);
... |
That will handle the loading and flipping of your textures. I leave the rest of the excercise of putting the textures into memory as an excercise for the reader.