-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDetailView.java
More file actions
72 lines (52 loc) · 2.03 KB
/
Copy pathDetailView.java
File metadata and controls
72 lines (52 loc) · 2.03 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
import java.awt.*;
import java.util.ArrayList;
import javax.swing.*;
public class DetailView extends JPanel {
private JPanel right = new JPanel();
public DetailView(Manga manga) {
Font data = new Font(Font.SANS_SERIF, Font.PLAIN, 22);
Font listData = new Font(Font.SANS_SERIF, Font.PLAIN, 18);
FlowLayout layout = new FlowLayout(FlowLayout.CENTER, 20, 20);
setLayout(layout);
setBackground(Pallet.sunGlow);
BoxLayout rightLayout = new BoxLayout(right, BoxLayout.Y_AXIS);
right.setLayout(rightLayout);
right.setOpaque(false);
//right.setPreferredSize(new Dimension(400, 600));
JLabel name = new JLabel(manga.getName());
name.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 32));
JLabel size = new JLabel("Size: " + manga.getSize());
ArrayList<String> chapters = manga.getChapters();
int chapterCount = chapters.size();
JLabel chaptersCountLabel = new JLabel("Chapters: " + chapterCount);
JScrollPane scrollFrame = new JScrollPane(right);
GridLayout chapterListLayout = new GridLayout(chapterCount, 1);
size.setFont(data);
chaptersCountLabel.setFont(data);
chapterListLayout.setVgap(10);
// add vertical spacing
scrollFrame.setBackground(Pallet.empty);
scrollFrame.setOpaque(false);
scrollFrame.setBorder(null);
scrollFrame.getViewport().setOpaque(false);
scrollFrame.setPreferredSize(new Dimension(400, 500));
scrollFrame.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
scrollFrame.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
right.add(Box.createVerticalGlue());
right.add(name);
right.add(size);
right.add(chaptersCountLabel);
if(chapterCount <= 1) {
chaptersCountLabel.setText("Uncatogized Chapter Format");
} else {
for(String chapter : chapters) {
JLabel chapterLabel = new JLabel(chapter);
chapterLabel.setFont(listData);
right.add(chapterLabel);
}
}
right.add(Box.createVerticalGlue());
add(new Thumbnail(manga.getName(), manga.getPage(1), manga));
add(scrollFrame);
}
}