This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Applets and the fly likes How to Add Images to Panels Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "How to Add Images to Panels" Watch "How to Add Images to Panels" New topic

How to Add Images to Panels

barron logan

Joined: Jun 30, 2004
Posts: 6
hi all,
i've been teaching myself java for the past few months and am currently working on a project. I'm experiencing trouble adding Images to Panels.
Can someone supply a working method(technique) to Adding Images to Panels?
Below is a portion of my code:

import java.awt.*;

public class Sample extends javax.swing.JApplet implements Runnable
Image[] picture = new Image[6];
int totalPictures = 0;
int current = 0;
Panel panel1 = new Panel();
Panel panel2 = new Panel();

public void init()
for (int i = 0; i<6; i++)
String imageText = null;
imageText = getParameter("image"+i);
if (imageText != null)
picture[i] = getImage
(getCodeBase(), imageText);

GridLayout grid = new GridLayout

/**how do you add the images to the


Joe Ess

Joined: Oct 29, 2001
Posts: 9138

Teaching yourself Java, eh? Then you probably know about the Java Tutorial, right? It covers the basics on most everything, including how to use Icons to do perform simple tasks with images and how to use the 2d Graphics API to manipulate and display graphics.

[How To Ask Questions On JavaRanch]
barron logan

Joined: Jun 30, 2004
Posts: 6
thanx for the recomendations Joe Ess. Those are some pretty great tutorials...
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: How to Add Images to Panels
It's not a secret anymore!