Ronald Vermeij wrote:
1. Is it (even) possible to display an (jpeg,gif) image in the "display area" while using a layout manager?
Surfing over the internet...so far i only have found applet-examples that use the full gui surface of the applet to display an image via the g.drawImage (imagename, x,y); without any gui elements (labels, buttons) beside it.
2. What kind of AWT gui element do i need at the location of the "display area"?
Is is possible to use a CANVAS or do i need somethen else? (e.g. glue an image on a button)
3. Is is possible to display an ANIMATION (series of sequences jpeg, gifs) in the display area?
I already found out how to locate and load the images (via mediatracker).
Now i need to find a way to "paint" the loaded images in the GUI.
4. Is this even possible with AWT layout or do i need to switch to SWING layout?
I have not used Swing yet, cause i'm working my way up through the oldest gui technologie first.
Campbell Ritchie wrote:Welcome to JavaRanch
The short answer is, yes, it is possible. But I think you are going about it the wrong way. Stop using AWT components and go straight to Swing. Nobody uses AWT components any more. Start with something simple if you are learning.
Rob Prime wrote:Campbell is right about forgetting all about AWT. If you switch to Swing, you can use a simple JLabel in combination with ImageIcon for displaying your images.
Brian Cole wrote:
1. Yes, and it's pretty easy if you want the image to appear at its natural size: new JLabel(new ImageIcon(yourJpegOrGif))
2. It is possible to use java.awt.Canvas, but it's easier to use javax.swing.JLabel
3. If you use JLabel's setIcon() method you don't have to mess with MediaTracker or painting.
But if you want to do the painting yourself, that works too. In that case you can use the repaint() method to force a redraw.