Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Jose Hughes   on Apr 18 In Java Category.

  
Question Answered By: Anthony Smith   on Apr 18

Java source:

/* ImageApplet.java
*/

import java.applet.*;
import java.awt.*;
import java.net.*;

public class ImageApplet extends Applet{

private image  image = null;

public void init(){
try{
URL imageURL = new URL(getDocumentBase(),"EinsteinBike.jpg");
image = getImage(imageURL);
}catch(MalformedURLException murle){
getAppletContext().showStatus("Image could not be loaded.");
}
}

public void paint(Graphics graphics){
graphics.drawImage(image,0,0,this);
}
}


html source:
<html>
<head>
<title>ImageApplet</title>
</head>
<body>
<h2 align="center">ImageApplet</h2>
<center><applet code="ImageApplet.class" codebase = "."
width="244" height="216">
alt="Your browser understands the <APPLET> tag
but isn't running the applet, for some reason."
Your browser is completely ignoring the <APPLET>
tag!
</applet></center>

<center>Back to the main menu</center>
</body>
</html>

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on How to create the first image for a program Or get search suggestion and latest updates.


Tagged: