-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmailPanel.java
More file actions
40 lines (35 loc) · 1.02 KB
/
EmailPanel.java
File metadata and controls
40 lines (35 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import javax.swing.*;
import java.awt.*;
/** @author Gergely Kota
EmailPanel provides fields to enter stuff into
*/
public class EmailPanel extends JPanel
{
private JTextArea body;
private SelectiveInfo from, subject;
private final String EMAIL1 = "shafik@email.arizona.edu";
private final String EMAIL2 = "gergelyk@email.arizona.edu";
public EmailPanel()
{
setLayout(new BorderLayout());
JPanel buffer = new JPanel(new GridLayout(2,1));
body = new JTextArea();
from = new SelectiveInfo("From", false, 100);
from.set("<Your email address>");
subject = new SelectiveInfo("Subject", false, 100);
buffer.add(from);
buffer.add(subject);
JScrollPane jsp = new JScrollPane();
jsp.getViewport().add(body);
add(buffer, BorderLayout.NORTH);
add(jsp, BorderLayout.CENTER);
}
public void send()
{
Jmail.send(from.read(), EMAIL1, "SPLAT: " + subject.read(), body.getText());
Jmail.send(from.read(), EMAIL2, "SPLAT: " + subject.read(), body.getText());
from.set("");
subject.set("");
body.setText("");
}
}