-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogs.java
More file actions
executable file
·120 lines (105 loc) · 3.61 KB
/
Logs.java
File metadata and controls
executable file
·120 lines (105 loc) · 3.61 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
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
/*
* Projet : Trustopics
* Version : 0.2.1
* Fichier : Logs.java
*/
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
public class Logs {
private static String glb_lastText = "";
private static String glb_lastTab = "";
private static JTextArea glb_textArea;
private static JFrame glb_frame;
private RoundButton glb_roundButtonOk;
private RoundViewPort glb_roundViewPort;
public Logs() {}
public void CreateWin() {
glb_frame = new JFrame("Logs");
MouseActions lcl_mouseActions = new MouseActions();
glb_frame.setBackground(Defines.UIcolBackGDrawing);
glb_frame.getContentPane().setLayout(new BorderLayout());
glb_frame.setSize(750,500);
glb_frame.setLocationRelativeTo(null);
glb_textArea = new JTextArea();
glb_textArea.setEditable(false);
glb_textArea.setBackground(Defines.UIcolBackGDrawing);
glb_textArea.setForeground(Color.ORANGE);
glb_textArea.setTabSize(4);
glb_textArea.setFont(new Font("monospaced",1,10));
glb_roundViewPort = new RoundViewPort(glb_textArea);
glb_frame.getContentPane().add(glb_roundViewPort,BorderLayout.CENTER);
JPanelBottom lcl_bottomPanel = new JPanelBottom(lcl_mouseActions);
lcl_bottomPanel.setLayout(null);
lcl_bottomPanel.setBackground(Defines.UIcolForeGDrawing);
lcl_bottomPanel.setPreferredSize(new Dimension(1,40));
glb_frame.getContentPane().add(lcl_bottomPanel,BorderLayout.SOUTH);
glb_frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) { glb_frame.dispose(); }
});
}
public void OpenWin() {
glb_frame.setVisible(true);
}
public void HideWin() {
glb_frame.setVisible(false);
}
public void Clear() {
glb_textArea.setText("");
}
public void Add(String prm_text) {
glb_lastText = prm_text;
glb_textArea.append(glb_lastTab + prm_text + "\n");
}
public void AddTab(int prm_nbTab) {
glb_lastTab = "";
for (int i = 0 ; i < prm_nbTab ; i++) glb_lastTab += "\t";
}
public void AddLine(String lcl_char) {
String lcl_line = "";
for (int i = 0 ; i < glb_lastText.length() ; i++) lcl_line += lcl_char;
glb_textArea.append(glb_lastTab + lcl_line + "\n");
}
public void AddEmpty() {
glb_textArea.append("\n");
}
public class JPanelBottom extends JPanel {
public JPanelBottom(MouseActions prm_mouseActions) {
glb_roundButtonOk = new RoundButton(" Ok ");
glb_roundButtonOk.setBackground(Defines.UIcolBackGDrawing);
glb_roundButtonOk.setActionCommand("ok");
glb_roundButtonOk.addActionListener(prm_mouseActions);
add(glb_roundButtonOk);
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(Defines.UIcolBackGDrawing);
g2.fillRoundRect(200,0,getWidth()-400,getHeight(),getHeight(),getHeight());
int lcl_wOk = glb_roundButtonOk.GetWidthText();
int lcl_hOk = glb_roundButtonOk.GetHeightText();
glb_roundButtonOk.setBounds((getWidth()/2)-(lcl_wOk/2),(getHeight()/2)-(lcl_hOk/2),lcl_wOk,lcl_hOk);
}
}
public class MouseActions implements ActionListener {
public void actionPerformed(ActionEvent prm_ev) {
String lcl_cmd = prm_ev.getActionCommand();
if (lcl_cmd.equals("ok")) {
glb_roundButtonOk.ClearButton();
glb_frame.dispose();
}
}
}
}