Hello
I am trying to do a simple java applet which loads image from a specified url.
Here is the code I have now, but it cant seem to work. -
-
import java.applet.*;
-
import java.awt.*;
-
-
public class ATestofLoadImage extends Applet {
-
-
Image image;
-
public void init() {
-
// Load image
-
image = getImage(getDocumentBase(), "http://127.0.0.1:8550/epe/map/render?name=Tag%201");
-
}
-
public void paint(Graphics g) {
-
// Draw image
-
g.drawImage(image, 0, 0, this);
-
}
-
}
-
-
When i compiled the program, there was no errors, but the applet doesnt load the image. The URL specified is correct; it can be loaded in the web browser.
What might be the problem?
Thank you for your help.
2 2343
Hello
I am trying to do a simple java applet which loads image from a specified url.
Here is the code I have now, but it cant seem to work. -
-
import java.applet.*;
-
import java.awt.*;
-
-
public class ATestofLoadImage extends Applet {
-
-
Image image;
-
public void init() {
-
// Load image
-
image = getImage(getDocumentBase(), "http://127.0.0.1:8550/epe/map/render?name=Tag%201");
-
}
-
public void paint(Graphics g) {
-
// Draw image
-
g.drawImage(image, 0, 0, this);
-
}
-
}
-
-
When i compiled the program, there was no errors, but the applet doesnt load the image. The URL specified is correct; it can be loaded in the web browser.
What might be the problem?
Thank you for your help.
Hi
There are two problems
1. use applet tag before the class name
ex. -
/*
-
<applet code="ATestofLoadImage" height="500" width="500">
-
</applet>
-
*/
-
2. Test your URL in the browser first then apply in the code. It seems that Your url is not working. http://127.0.0.1:8550/epe/map/render?name=Tag %201
if you are getting the image in the browser then will will also be getting it in the applet.
JosAH 11,448
Recognized Expert MVP
Hello
I am trying to do a simple java applet which loads image from a specified url.
Here is the code I have now, but it cant seem to work. -
-
import java.applet.*;
-
import java.awt.*;
-
-
public class ATestofLoadImage extends Applet {
-
-
Image image;
-
public void init() {
-
// Load image
-
image = getImage(getDocumentBase(), "http://127.0.0.1:8550/epe/map/render?name=Tag%201");
-
}
-
public void paint(Graphics g) {
-
// Draw image
-
g.drawImage(image, 0, 0, this);
-
}
-
}
-
-
When i compiled the program, there was no errors, but the applet doesnt load the image. The URL specified is correct; it can be loaded in the web browser.
What might be the problem?
Thank you for your help.
Only the first argument is supposed to represent a URL; the second parameter
is just the name of the image. You could just use the second parameter only.
Read the API documents for the Applet class to see the exact meaning of both
parameters.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Doug van Vianen |
last post by:
Although I have programmed for several decades I am new to Java. I decided
to learn it to create Applets to use in web pages I make as a volunteer in
the computer club at a seniors' centre.
My current learning project is to divide a picture into rows and columns of
squares, then redisplay the picture with these squares positioned randomly
in the rows and columns.
In an applet I have stored the original picture as an image, divided it...
|
by: Mark Richards |
last post by:
An applet on one of my pages uses a big picture as background.
I want to load it before the applet and the rest of the html source.
By doing this I want to avoid that the pane of the applet is grey during the
load of the picture.
How do I do that?
Or even better: How can I display something like a progress bar or at least a temporary, self removing
message (dialog) "Please wait a few second..." until the picture and the applet were...
|
by: Jacques Chaurette |
last post by:
Hello all , thanks in advance for any help. While looking for a solution to how to replace the grey box while an applet loads, a search of Google got me an article by Glenn s. Peffers that claims to solve the problem.
You can find the article at http://www.codeproject.com/java/javaappletwaitmsg.asp
I have adapted the code to my situation but can't get it to work. Maybe someone has an idea how to fix it... Here is the code
Cheers,
Jacques...
|
by: Alixx Skevington |
last post by:
I want to be able to have a page that has several controls on on it, but I
want the page to load first of all and display a loading image on each
control and then I want to then display teh controls as the data has bound
to each control as some of the data I need to load is very big and takes
some time.
I have found some code that creates a Javascript that handles this, but it
only works at page level.
I have looked at the ATLAS...
|
by: UnkleVo |
last post by:
Hello all,
We have a form that contains browser control on it. Into that control
we load some java applet that acts as an image viewer.
On the form load we load the list of documents each with it's own URL
that is pointing to the doc location.When you click on the item in the
list it loads the document from the url that this item points to.
Problem is that when java applet loads the first time it takes forever.
| |
by: takeiteasy |
last post by:
Hello everyone,
I've got a question about programming by using Java applet and the question is :
Design a web page containing an applet that simply switches from one image to the next with some transition effects such as :
Fade: Fade one image out while you fade the next one in.
Whirlpool fade: Building on the fade transition, rather than just fading between images the first image swirls out of focus; the swirl is then reversed and...
|
by: speedcoder |
last post by:
hi all,
i'm stumped. my applet used to load images over the network. (it was actually designed by someone else.) yes, the applet used to load each image file independently over the network and incurred a network hit per image file.
i wanted to avoid the overhead of a separate network connection for each image file, so i bundled all the images into the JAR file. yet, somehow, the loading time for the applet is slower now! i'm totally...
|
by: rajbala.3399 |
last post by:
Hi all,
I have the netbeans IDE5.5 in my system and redhat9.While i run my
plugin or beans program in JSP the output you see an image that looks
like a small white box with a Red X in it. Or, the browser cannot
display the chat applet, and shows the error message "Loading Java
Applet Failed...".
I gone through the below sites and i tried each and every thing but it
didn't work not only this no. of site to get solve but no use.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |