Anyways, I have a problem. I am relatively new to Java and I am still getting used to everything.
I thought I could just quickly program something with a few graphics and such but then I already encountered my first problems.
I found this more or less tutorial on the import of bufferedimages and thought I can use this as it would be exactly what I need. I encountered the first problem when I started trying to use it.
//the original idea was to just make a constructor load the image and draw it by adding it to my JFrame
JFrame f = new JFrame("Load Image");
f.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
f.add(new gphx("path of image", pos_x, pos_y);
f.add(new gphx("path of other image", pos_x_2, pos_y_2);
f.pack();
f.setVisible(true);
this was a problem though as it would not overlay images. So, I thought I should just make my image class to where it contains all images that should be drawn like this:
JFrame f = new JFrame("Load Image");
JLabel label = new JLabel("This does not work");
f.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
gphx g = new gphx(800,800);
g.loadImage("strawberry.jpg",50,50);
g.loadImage("pGlo.jpg",190,100);
f.add(g);
f.add(label);
f.pack();
f.setVisible(true);
it works perfectly with the images, but when i want to add another layer (the text) then it only draws either or, (only the one that i add last to my JFrame...so long story short, my question is how do i make it to where i can just have everything in there with pictures/text overlapping?

New Topic/Question
Reply


MultiQuote



|