Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

How to create the first image for a program

  Asked By: Jose    Date: Apr 18    Category: Java    Views: 2258
  

I try to make a program to some
company. so could any one tell me how to create the first image for a
program. what I mean is like when we run Internet Explorer it will
show us the image first which has no frame

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Anthony Smith     Answered 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>

 
Answer #2    Answered By: Edna West     Answered On: Apr 18

I loaded that applet at:
www.quantumhyperspace.com/.../ImageApplet.html

from there you can run  it, get the source code and image  file.
Best of wished in your programming.

 
Answer #3    Answered By: Guilherme Silva     Answered On: Apr 18

you can use the image  function
getImage()

 
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: