Article View: borland.public.jbuilder.java.language
Article #8372Re: displaying a gif file
From: Carlos Ojea Castro
Date: Tue, 27 Mar 2001 15:01
Date: Tue, 27 Mar 2001 15:01
42 lines
1817 bytes
1817 bytes
Hello Dave :
Perhaps this code helps to display a gif file "digit.gif":
// File DisplayGif.java
import java.applet.Applet;
import java.awt.*;
public class DisplayGif extends Applet
{
public void paint(Graphics g)
{
Image image;
image = getImage(getCodeBase(), "digit.gif");
g.drawImage(image, 0, 0, this);
}
}
You also should write a web page like this:
<HTML>
<HEAD>
<TITLE> A Simple Program </TITLE>
</HEAD>
<BODY>
<APPLET CODE="DisplayGif.class" WIDTH=150 HEIGHT=25>
</APPLET>
</BODY>
</HTML>
Dave Cullen wrote:
> Can anyone point me to Java classes and methods appropriate for loading and
> displaying a gif file on an html page? It's for an applet.
>
> If it matters, I want to create a web page hit counter in Java. I have gif
> files of fancy digits 0-9, and I need to load them in, display them and
> position them side-by-side to create the effect of a multi-digit number.
>
> Thanks.
>
> drc
Technical Details
Message-ID:
<3AC0AB54.55AB5231@rslcom.es>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!zeus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!213.250.128.151References:
<3ab8f414$1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,5b4d80c6761c692b X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-27 07:42:06 PST Message-ID: <3AC0AB54.55AB5231@rslcom.es> Date: Tue, 27 Mar 2001 17:01:40 +0200 From: Carlos Ojea Castro <ccastro@rslcom.es> X-Mailer: Mozilla 4.74 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: displaying a gif file References: <3ab8f414$1_1@dnews> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 213.250.128.151 X-Trace: 27 Mar 2001 07:01:23 -0800, 213.250.128.151 Lines: 43 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!zeus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!213.250.128.151