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.bhalla1335@gmail.com thanks regards aman bhalla
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 [thread=168]Before you make a query[/thread] thread.
Hey aman , // check this out Code: 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; } ... }).execute(); } ... 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( this.getClass().getResourceAsStream(path)); if (imgStream != null) { byte buf[] = new byte[MAX_IMAGE_SIZE]; try { count = imgStream.read(buf); imgStream.close(); } catch (java.io.IOException 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; } }