So I am attempting to make a program that needs to be able to display an arbitrary number of images at specific pixel locations.
So far I have discovered that using templates are completely useless for anything involving specific locations, but I can't seem to render multiple images on a single panel without using them, so I am at an impasse between the two requirements.
Can someone point me to a good resource to use or some tips as to what I should be doing to accomplish what I want?
For reference, this is what I am using to load an image:
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
import javax.swing.*;
public class Btn_Graphic extends JPanel
{
private BufferedImage image;
private int xpos, ypos;
public Btn_Graphic(String path, int x, int y)
{
try
{
image = ImageIO.read(new File(path));
}
catch(IOException ex)
{
// too darn bad
}
this.xpos = x;
this.ypos = y;
}
public void paintComponent(Graphics g)
{
super.paintComponent(g);
g.drawImage(image, this.xpos, this.ypos, null);
}
}
Thanks in advance for the help.