Sharp Tan

Greenhorn
+ Follow
since Aug 16, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sharp Tan

Hi Nathan,
Thanks for your response.
For my project, I do need to read and proccess the image. I do have the right to use the image. My problem is I need do these jobs online. So, have any solution to solve it?
By the way, anybody has experience to signe an Applet? I mean allowing a server other than the one applet's from trusts the applet.
Thank you very much for your help!
Sharp
22 years ago
Hi Daniel,
Thanks for your response!
Fowllowing is my applet source: If the image from the same domain as the applet, it works. If not, no error on image. Would you mind tell why? Thanks again.
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.JApplet;
import java.net.*;
public class Simple extends Applet {
StringBuffer buffer;
Image image;
public void init() {
buffer = new StringBuffer();
addItem("initializing... ");
try {
// image = tk.getImage(new URL("http://localip:8080/Radiation/images/radiation/GR1620B.jpg"));
URL url = new URL("http://java.sun.com/images/logos/javalogo52x88.gif");
image = this.getImage(url);
} catch(Exception e) {
System.out.println(e.getMessage());
}
}
public void start() {
addItem("starting... ");
}
public void stop() {
addItem("stopping... ");
}
public void destroy() {
addItem("preparing for unloading...");
}
void addItem(String newWord) {
System.out.println(newWord);
buffer.append(newWord);
repaint();
}
public void paint(Graphics g) {
g.drawImage(image, 0, 0, this);
}
}
Regards,
Sharp
22 years ago
In my project, I need display a image frome other web site. Anybody knows how to do it? Please give me s piece of sample code.
Thanks for your help!
Sharp
22 years ago
Hi folks,
I try to show a image from other web site in my applet. Is it possible? If it is possible, pls kindly give me a sample code! I'm very appreciate for your help.
Thanks and Best Regards,
Sharp
22 years ago
Hi all,
I try to access same web pages and image files from a potal. Someone suggested me to use "Authenticator" class. I create a subclass named "myAuthenticator" as following:
class myAuthenticator extends Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
System.out.println("Password needed");
return new PasswordAuthentication("myid", "pw".toCharArray());
}
}
Before I create a URLConnection I call
Authenticator.setDefault(new myAuthenticator);
I try to access "http://mail.yahoo.com" and my own potal. It doesn't work. What I get is still the login page.
Who know the reason? Anybody has solution to solve my problem?
I'm very thankful for your help!
Sharp
22 years ago
Hi all,
I try to access same web pages and image files from a potal. Someone suggested me to use "Authenticator" class. I create a subclass named "myAuthenticator" as following:
class myAuthenticator extends Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
System.out.println("Password needed");
return new PasswordAuthentication("myid", "pw".toCharArray());
}
}
Before I create a URLConnection I call
Authenticator.setDefault(new myAuthenticator);
I try to access "http://mail.yahoo.com" and my own potal. It doesn't work. What I get is still the login page.
Who know the reason? Anybody has solution to solve my problem?
I'm very thankful for your help!
Sharp