help required

bhalla1335's Avatar, Join Date: Apr 2007
Newbie Member
hi everyone
well i need urgent help from all you java programmers
well i have never done java before and have to make an applet
its a very simple basic one but as i told u guys i dont even know even the abcd of java
so can anyone of you help me
if you could please reply at
aman bhalla
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
You have submitted as an article under the java forum but it should be under the Employer forum of queries and discussion and I have moved the thread at the right place.

Also having a better title will give better responses to your query. I would suggest you read Before you make a query thread.
ronsan's Avatar, Join Date: May 2007
Light Poster
Hey aman ,
// check this out

public void init() {
    imgs = new ImageIcon[nimgs];
    (new SwingWorker() {
        public ImageIcon[] doInBackground() {
            //Images are numbered 1 to nimgs,
            //but fill array from 0 to nimgs-1.
            for (int i = 0; i < nimgs; i++) {
                imgs[i] = loadImage(i+1);
            return imgs;

protected ImageIcon loadImage(int imageNum) {
    String path = dir + "/T" + imageNum + ".gif";
    int MAX_IMAGE_SIZE = 2400;  //Change this to the size of
                                 //your biggest image, in bytes.
    int count = 0;
    BufferedInputStream imgStream = new BufferedInputStream(
    if (imgStream != null) {
        byte buf[] = new byte[MAX_IMAGE_SIZE];
        try {
            count =;
        } catch ( ioe) {
            System.err.println("Couldn't read stream from file: " + path);
            return null;
        if (count <= 0) {
            System.err.println("Empty file: " + path);
            return null;
        return new ImageIcon(Toolkit.getDefaultToolkit().createImage(buf));
    } else {
        System.err.println("Couldn't find file: " + path);
        return null;

Last edited by shabbir; 7May2007 at 11:58.. Reason: Code block