forked from dominik1999w/ReminderApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReminderFrame.java
More file actions
62 lines (50 loc) · 2.35 KB
/
Copy pathReminderFrame.java
File metadata and controls
62 lines (50 loc) · 2.35 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
package reminder;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.*;
import java.util.List;
import java.util.stream.*;
public class ReminderFrame extends JFrame {
private FileManager fileManagerEng;
private FileManager fileManagerPol;
private String filePathEng = "D:\\Agnieszka\\Documents\\englishWords.txt"; // path to file with english words
private String filePathPol = "D:\\Agnieszka\\Documents\\polishWords.txt"; // path to file with polish translation
private List<String> listEng, listPol;
private Cell[][] cells = new Cell[5][3];
public ReminderFrame() throws Exception {
JPanel panel = new JPanel(new GridLayout(5, 3, 0, 0));
for (int i = 0; i < 5; i++)
for (int j = 0; j < 3; j++)
panel.add(cells[i][j] = new Cell());
panel.setBorder(new LineBorder(Color.BLACK, 2));
add(panel, BorderLayout.CENTER);
fileManagerEng = new FileManager(filePathEng);
fileManagerPol = new FileManager(filePathPol);
listEng = fileManagerEng.readFileInList();
listPol = fileManagerPol.readFileInList();
}
//CELL CLASS
public class Cell extends JPanel {
public Cell() throws Exception {
JTextArea textArea = new JTextArea("AAAAAA",4,12);
//String data = readFileAsString();
//textArea.setText(data);
textArea.setFont(new Font("Arial", 1, 20));
textArea.setLineWrap(true);
Border border = BorderFactory.createLineBorder(Color.BLACK);
textArea.setBorder(BorderFactory.createCompoundBorder(border,BorderFactory.createEmptyBorder(10, 10, 10, 10)));//creating borders and margins
textArea.setWrapStyleWord(true);
add(textArea,BorderLayout.CENTER);
}
/*public String readFileAsString() throws IOException{
StringBuilder contentBuilder = new StringBuilder();
Stream<String> stream = Files.lines(Paths.get("C:\\Users\\DELL\\Desktop\\launch4j.log"),StandardCharsets.UTF_8);
stream.forEach(s -> contentBuilder.append(s).append("\n"));
return contentBuilder.toString();
}*/
}
}