Skip to content

Commit 6052505

Browse files
committed
java doc for flashcard set data panel
1 parent 63a59b2 commit 6052505

File tree

1 file changed

+33
-28
lines changed

1 file changed

+33
-28
lines changed

src/main/java/frameworks_and_drivers/components/FlashcardSetDataPanel.java

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,53 @@
2222
import java.awt.event.WindowEvent;
2323
import java.awt.event.WindowListener;
2424

25+
/**
26+
* Abstract class that represents a panel for an individual flashcard set.
27+
* This panel includes buttons for study, edit, test, and delete.
28+
* Frameworks & Drivers
29+
* @author Justin Li
30+
*/
2531
public class FlashcardSetDataPanel extends JPanel implements WindowListener {
32+
/**
33+
* The main JFrame that the flashcard set data panel will lie in.
34+
*/
2635
HomeScreen home;
36+
37+
/**
38+
* Creates a FlashcardSetDataPanel object that includes the title, description, flashcardSetId, gateway,
39+
* user, and home.
40+
* @param title the title of the flashcard set.
41+
* @param description the description of the flashcard set.
42+
* @param flashcardSetId the flashcard set id.
43+
* @param gateway the gateway to reach the flashcard set.
44+
* @param user the user that owns that flashcard set.
45+
* @param home the home screen containing the flashcard set panel.
46+
*/
2747
public FlashcardSetDataPanel(String title, String description,
2848
int flashcardSetId, DBGateway gateway,
2949
UserLoginResponseModel user, HomeScreen home) {
50+
// Panel Construction
3051
Border border = BorderFactory.createTitledBorder(title);
3152

32-
3353
JLabel descriptionLabel = new JLabel(description);
3454
this.add(descriptionLabel);
3555
this.home = home;
56+
57+
// Button Construction
3658
JPanel buttons = new JPanel();
3759

3860
JButton study = new JButton("Study");
3961
buttons.add(study);
62+
4063
JButton test = new JButton("Test");
4164
buttons.add(test);
65+
4266
JButton edit = new JButton("Edit");
4367
JButton delete = new JButton("Delete");
44-
45-
4668
buttons.add(edit);
4769
buttons.add(delete);
4870

71+
// Action listeners for edit, study, test, and delete buttons.
4972
edit.addActionListener((e) -> {
5073
EditorMainScreen editor = new EditorMainScreen(flashcardSetId);
5174
editor.addWindowListener(this);
@@ -77,39 +100,21 @@ public FlashcardSetDataPanel(String title, String description,
77100
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
78101
}
79102

80-
81103
@Override
82-
public void windowOpened(WindowEvent e) {
83-
84-
}
85-
104+
public void windowOpened(WindowEvent e) {}
86105
@Override
87-
public void windowClosing(WindowEvent e) {
88-
}
89-
106+
public void windowClosing(WindowEvent e) {}
90107
@Override
91108
public void windowClosed(WindowEvent e) {
109+
// When a window is closed we will refresh the page.
92110
home.refresh();
93-
94111
}
95-
96112
@Override
97-
public void windowIconified(WindowEvent e) {
98-
99-
}
100-
113+
public void windowIconified(WindowEvent e) {}
101114
@Override
102-
public void windowDeiconified(WindowEvent e) {
103-
104-
}
105-
115+
public void windowDeiconified(WindowEvent e) {}
106116
@Override
107-
public void windowActivated(WindowEvent e) {
108-
109-
}
110-
117+
public void windowActivated(WindowEvent e) {}
111118
@Override
112-
public void windowDeactivated(WindowEvent e) {
113-
114-
}
119+
public void windowDeactivated(WindowEvent e) {}
115120
}

0 commit comments

Comments
 (0)