The Artima Developer Community
Sponsored Link

Java Answers Forum
Email,Applets and Result

2 replies on 1 page. Most recent reply: May 11, 2004 5:54 AM by Shara

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
DAYO

Posts: 22
Nickname: done
Registered: Jun, 2002

Email,Applets and Result Posted: Jun 16, 2002 4:46 PM
Reply to this message Reply
Advertisement
I have designed a web page with an applet.Users give input to the applet and it produces some results.I have been told i cannot save on the users hard disk because applets do not allow it but is there a way to send,the result and input, to the user via email.Someone told me there are on-line chess games
that do this.Does anybody know how to do this?
Thank you
P.S:i am new to JAVA so please bear with me


Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: Email,Applets and Result Posted: Jun 17, 2002 12:00 AM
Reply to this message Reply
Here is a simple Email Applet which will cause the
user's email client to bring up a filled in email message when clicked which you could adapt to your project and send simple email messages to others.
You could easily adapt this to your particular situation:


/* EmailApplet.java
* @author: Charles Bell
* @version: June 17, 2002
*/

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

public class EmailApplet extends Applet implements ActionListener{

private TextField fromField;
private TextField toField;
private TextField subjectField;
private TextArea bodyArea;

public void init(){
Panel top = new Panel();
top.setLayout(new GridLayout(2,2));
Panel middle = new Panel();
Panel bottom = new Panel();
toField = new TextField(20);
subjectField = new TextField(20);
bodyArea = new TextArea(4,50);
Button sendButton = new Button("Send");
sendButton.addActionListener(this);
top.add(new Label("To:"));
top.add(toField);
top.add(new Label("Subject:"));
top.add(subjectField);
middle.add(bodyArea);
bottom.add(sendButton);
setLayout(new BorderLayout());
add(top, BorderLayout.NORTH);
add(middle, BorderLayout.CENTER);
add(bottom, BorderLayout.SOUTH);

}

public void actionPerformed(ActionEvent ae){
if (ae.getActionCommand().compareTo("Send") == 0){
sendIt();
}
}

public void sendIt(){
String to = toField.getText();
String subject = subjectField.getText();
String body = bodyArea.getText();
String urlString = "mailto:"+to +"?"
+"&Subject=" + subject
+"&Body=" + body;
try{
URL mailUrl = new URL(urlString);
AppletContext context = getAppletContext();
context.showDocument(mailUrl);
}catch(MalformedURLException murle){
System.err.println("MalformedURLException: " + murle.getMessage());
}
}
}



<html>
<head>
<title>EmailApplet</title>
</head>
<body>
??? <center><applet code="EmailApplet.class" width="400" height="200"></applet></center>
</body>
</html>


This applet is live now at:
http://www.quantumhyperspace.com/EmailApplet/EmailApplet.html

you can try it out and send someone or yourself a message.

Shara

Posts: 1
Nickname: shara
Registered: May, 2004

URGENT Posted: May 11, 2004 5:54 AM
Reply to this message Reply
HELLO

IT SHARA, PLEASE I NEED A PRIVATE DISCUSSION WITH YOU PLEASE CAN YOU CONTACT ME WITH MY EMAIL SO THAT WE CAN HAVE IT ALL DISCUSSED. IT IS ALL ABOUT BUSINESS.

EMAIL :j_s_w20032000@yahoo.fr

THANKS
WAITING.
SHARA

Flat View: This topic has 2 replies on 1 page
Topic: reg. StreamCorruptedException Previous Topic   Next Topic Topic: Reading from a db

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use