Newer
Older
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
package fucoin;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.time.Duration;
import java.util.concurrent.Executors;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JTextField;
import fucoin.actions.JoinActionRespond;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.dispatch.Dispatcher;
import akka.dispatch.ExecutorServiceFactoryProvider;
import akka.dispatch.MessageDispatcherConfigurator;
import akkateststuff.Node;
public class Main {
private static Main singleton;
public static Main getSingleton() {
return singleton;
}
public final ActorSystem system;
public ActorSystem getSystem() {
return system;
}
public Main() {
this.singleton=this;
system = ActorSystem.create("MySystem");
system.actorOf(Wallet.props(null,"Main"),"main");
}
public void start(){
//43 tells 42 join
}
static int walletCounter = 0;
public static void main(String[] args) {
Main main = new Main();
main.start();
JFrame frame = new JFrame("Manager");
frame.setLayout(new GridLayout(3,2));
frame.add(new JLabel("Connect to:"));
JTextField input = new JTextField("akka://MySystem/user/main");
frame.add(input);
frame.add(new JLabel("Name:"));
JTextField name = new JTextField(""+walletCounter);
frame.add(name);
JButton button = new JButton("connect");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
/*MessageDispatcherConfigurator mc = null;
String id = input.getText()+"-dispatched";
int hroughput = 1;
Duration d = Duration.ofSeconds(2);
Dispatcher d = new Dispatcher(mc,id, 1, d, Executors.newSingleThreadExecutor(),1000);*/
getSingleton().getSystem().actorOf(Wallet.props(input.getText(),name.getText()),name.getText());
}
});
frame.add(button);
frame.setSize(300, 300);
frame.setVisible(true);
}
}