-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamOp3Pop.java
126 lines (98 loc) · 3.27 KB
/
amOp3Pop.java
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package com.company;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.HashMap;
public class amOp3Pop extends JFrame{
private JTextField textreciver;
private JLabel labelreciver;
private JTextField textmessage;
private JLabel labelmessage;
protected HashMap<String,String> message=new HashMap<>();
private JTextField textInterest;
private JLabel labelInterest;
private JTextField textDose;
private JLabel labelDose;
protected boolean ps=false;
/**
* <p>
*this is the gui and code for the choice to send a message in the admin menu made with java swing
*<br>
* @param -
* @return
* @see -
* @author tsig-404
*/
public amOp3Pop(HashMap<String,String>msg) {
this.message=msg;
setTitle("Send message");
setLocationRelativeTo(null);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setResizable(true);
JPanel panel1 = new JPanel();
TitledBorder border = BorderFactory.createTitledBorder(" message ");
panel1.setBorder(border);
GridLayout layout = new GridLayout(4, 2, 2, 2);
panel1.setLayout(layout);
labelreciver = new JLabel("Receiver:");
panel1.add(labelreciver);
textreciver = new JTextField("");
panel1.add(textreciver);
labelmessage = new JLabel("Message:");
panel1.add(labelmessage);
textmessage = new JTextField("");
panel1.add(textmessage);
add(panel1, BorderLayout.CENTER);
JPanel panel2 = new JPanel();
JButton bc = new JButton("Send");
bc.addActionListener(new ActionListener() {
//bc.addMouseListener(new MouseAdapter() {
@Override
public void actionPerformed(ActionEvent e) {
//public void mouseClicked(MouseEvent e) {
String sms = new String(textmessage.getText());
String rec = new String(textreciver.getText());
message.put(sms, rec);
System.out.println("2messages:");
System.out.println(message);
send();
}
});
panel2.add(bc);
add(panel2, BorderLayout.PAGE_END);
send();
pack();
setVisible(true);
}
boolean send() {
//long amount = Integer.parseInt(textAmount.getText());
/*
if(ps==true ) {
String sms = new String(textmessage.getText());
String rec = new String(textreciver.getText());
message.put(sms, rec);
System.out.println("2messages:");
System.out.println(message);
}
else
{
System.out.println("nope");
}
*/
return ps;
}
public HashMap<String,String> getMessage()
{
System.out.println("messages:");
System.out.println(message);
return this.message;
}
public boolean tt()
{
return ps;
}
}