-
Notifications
You must be signed in to change notification settings - Fork 0
/
GuiServer.java
72 lines (59 loc) · 2.28 KB
/
GuiServer.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
package remote;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.SpringLayout;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import java.awt.Color;
//====== Handling events ======
import java.awt.event.*;
//====== Mapping (GuiChat - ServerActor) ======
import akka.actor.ActorRef;
public class GuiServer extends JFrame {
private JPanel contentPane;
private JTextArea log;
private ActorRef serverActor;
private Messages messages;
public void printBootstrapMessage() {
log.setText("CHAT SERVICE HAS BEEN SUCCESSUFULY STARTED\n");
}
public JTextArea getLog() {
return this.log;
}
public void setActorReference(ActorRef serverActor) {
this.serverActor = serverActor;
}
/*constructor: build in the gui*/
public GuiServer() {
messages = new Messages();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 596, 601);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
SpringLayout sl_contentPane = new SpringLayout();
contentPane.setLayout(sl_contentPane);
JLabel lblStatus = new JLabel("STATUS");
sl_contentPane.putConstraint(SpringLayout.NORTH, lblStatus, 0, SpringLayout.NORTH, contentPane);
sl_contentPane.putConstraint(SpringLayout.WEST, lblStatus, 255, SpringLayout.WEST, contentPane);
lblStatus.setForeground(new Color(50, 205, 50));
lblStatus.setFont(new Font("Yu Gothic UI Semilight", Font.BOLD, 15));
contentPane.add(lblStatus);
JScrollPane scrollPane = new JScrollPane();
sl_contentPane.putConstraint(SpringLayout.NORTH, scrollPane, 4, SpringLayout.SOUTH, lblStatus);
sl_contentPane.putConstraint(SpringLayout.WEST, scrollPane, 15, SpringLayout.WEST, contentPane);
sl_contentPane.putConstraint(SpringLayout.SOUTH, scrollPane, -5, SpringLayout.SOUTH, contentPane);
sl_contentPane.putConstraint(SpringLayout.EAST, scrollPane, -15, SpringLayout.EAST, contentPane);
contentPane.add(scrollPane);
log = new JTextArea();
log.setEditable(false);
log.setFont(new Font("Yu Gothic UI Semilight", Font.PLAIN, 15));
log.setForeground(Color.BLACK);
scrollPane.setViewportView(log);
}
}