Results 1 to 2 of 2
Thread: applet
- 05-15-2008, 01:30 PM #1
Member
- Join Date
- May 2008
- Posts
- 24
- Rep Power
- 0
applet
import java.awt.*;
import java.applet.*;
public class a extends Applet
{
Image q;
public void init()
{
q=getImage(getCodeBase(),"red.png");
}
public void paint(Graphics e)
{
e.drawImage(q,200,290,this);
}
}
i hav written this program but it is not showing any red image it is not showing any thing in applet how can i load the icon.png from a folder do i hav to set the class path if so how
- 05-16-2008, 03:24 AM #2
Java Code:// <applet code="LoadAndDraw" width="400" height="400"></applet> import java.awt.*; import java.applet.*; public class LoadAndDraw extends Applet { Image q; public void init() { String path = "images/hawk.jpg"; // Create image object. q=getImage(getCodeBase(), path); // Load the image data. MediaTracker mt = new MediaTracker(this); mt.addImage(q, 0); try { mt.waitForID(0); } catch(InterruptedException e) { System.out.println(mt.statusAll(false)); } } public void paint(Graphics e) { e.drawImage(q, 50, 50, this); } }
Similar Threads
-
log4j with Applet
By sunjavaboy in forum Java AppletsReplies: 0Last Post: 03-25-2008, 12:13 AM -
First Applet HELP????
By nvidia in forum New To JavaReplies: 0Last Post: 08-13-2007, 10:11 PM -
Applet Question
By nvidia in forum Java AppletsReplies: 1Last Post: 08-13-2007, 07:31 PM -
Applet
By kapoorje in forum Java AppletsReplies: 0Last Post: 07-24-2007, 04:06 PM -
Applet, To center text and To open I engage in a dialog in an Applet
By Marcus in forum Java AppletsReplies: 4Last Post: 06-08-2007, 06:15 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks