This repository was archived by the owner on Nov 16, 2017. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathhelpBox.java
More file actions
Latest commit
109 lines (94 loc) · 3.59 KB
/
Copy pathhelpBox.java
File metadata and controls
109 lines (94 loc) · 3.59 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
/*
* By attaching this document to the given files (the �work�), you, the licensee,
* are hereby granted free usage in both personal and commerical environments,
* without any obligation of attribution or payment (monetary or otherwise).
*
* The licensee is free to use, copy, modify, publish, distribute, sublicence,
* and/or merchandise the work, subject to the licensee inflecting a positive
* message unto someone. This includes (but is not limited to): smiling,
* being nice, saying �thank you�, assisting other persons, or any
* similar actions percolating the given concept.
*
* The above copyright notice serves as a permissions notice also,
* and may optionally be included in copies or portions of the work.
*
* The work is provided �as is�, without warranty or support, express or implied.
* The author(s) are not liable for any damages, misuse, or other claim, whether
* from or as a consequence of usage of the given work.
*/
packageProiect;
importjava.awt.*;
importjava.awt.event.*;
importjava.io.*;
importjavax.swing.*;
/**
* The class for the Help Window
*
* @author Stefan Cosma
*
*/
publicclasshelpBox {
publicstaticImageIcongetImageIcon(Stringname) {
returnnewImageIcon(ClassLoader.getSystemResource(name));
}
publichelpBox() throwsIOException {
finalJFramehelpbox = newJFrame("Help");
ComponentMovercm = newComponentMover();
cm.registerComponent(helpbox);
JLabellabel = newJLabel("");
JButtonexit = newJButton("");
JTextAreatext = newJTextArea(26, 33);
JScrollPanescrol = newJScrollPane(text);
helpbox.setSize(420, 500);
helpbox.setLocationRelativeTo(Encrypter.Center);
helpbox.setResizable(false);
helpbox.setIconImage(Toolkit.getDefaultToolkit().getImage(
getClass().getClassLoader().getResource("assets/ico.png")));
helpbox.setUndecorated(true);
helpbox.getRootPane().setBorder(
BorderFactory.createLineBorder(Encrypter.color_black, 2));
helpbox.setVisible(true);
helpbox.getContentPane().setBackground(Encrypter.color_light);
helpbox.setLayout(newFlowLayout());
helpbox.add(label);
helpbox.add(Box.createHorizontalStrut(330));
helpbox.add(exit);
helpbox.add(scrol);
ImageIconlabel_Icon = getImageIcon("assets/icons/help.png");
label.setIcon(label_Icon);
label.setForeground(Encrypter.color_blue);
label.setFont(Encrypter.font16);
text.setEditable(false);
text.setSelectionColor(Encrypter.color_black);
text.setSelectedTextColor(Encrypter.color_white);
text.setBackground(Encrypter.color_light);
scrol.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
scrol.setViewportBorder(BorderFactory.createLineBorder(
Encrypter.color_black, 0));
ImageIconexit_icon = getImageIcon("assets/icons/exit.png");
exit.setBackground(Encrypter.color_light);
exit.setBorder(BorderFactory.createLineBorder(Encrypter.color_dark, 0));
exit.setForeground(Encrypter.color_black);
exit.setFont(Encrypter.font16);
exit.setIcon(exit_icon);
exit.setToolTipText("Exit");
try {
FileReaderfile = newFileReader(ClassLoader.getSystemResource(
"assets/helpBox.txt").getPath());
BufferedReaderbuff = newBufferedReader(file);
Stringline = null;
while ((line = buff.readLine()) != null) {
text.append(line);
text.append("\n");
}
buff.close();
} catch (FileNotFoundExceptione) {
e.printStackTrace();
}
exit.addActionListener(newActionListener() {
publicvoidactionPerformed(ActionEventarg0) {
helpbox.dispose();
}
});
}
}