@@ -33,6 +33,7 @@ public class DeletionScreen extends JFrame implements ActionListener {
33
33
* A window with a title and a JButton.
34
34
*/
35
35
public DeletionScreen (int flashcardSetID , DelFlashcardSetController controller , UserLoginResponseModel user ) {
36
+ this .user =user ;
36
37
this .flashcardSetID = flashcardSetID ;
37
38
this .controller = controller ;
38
39
@@ -60,6 +61,7 @@ public DeletionScreen(int flashcardSetID, DelFlashcardSetController controller,
60
61
61
62
this .setVisible (true );
62
63
this .setDefaultCloseOperation (JFrame .DISPOSE_ON_CLOSE );
64
+ this .setSize (1000 , 800 );
63
65
}
64
66
65
67
/**
@@ -78,14 +80,15 @@ public void actionPerformed(ActionEvent evt) {
78
80
// int id = Integer.parseInt(flashcardSetID.getText()); // check input is an integer
79
81
80
82
// Ask for confirmation
83
+ String title = user .getFlashcardSets ().get (flashcardSetID )[0 ];
84
+
81
85
int confirmation = JOptionPane .showConfirmDialog (this ,
82
- "Delete Flashcard set # " + flashcardSetID + "?" ,
86
+ "Delete " + title + "?" ,
83
87
"Confirmation" , JOptionPane .YES_NO_OPTION , JOptionPane .QUESTION_MESSAGE );
84
88
if (confirmation == 0 ) {
85
89
try {
86
90
controller .delete (flashcardSetID );
87
- JOptionPane .showMessageDialog (this , "Flashcard Set #"
88
- + flashcardSetID + " has been deleted." );
91
+ JOptionPane .showMessageDialog (this , title + " has been deleted." );
89
92
this .dispose (); // exit deletion screen
90
93
} catch (FlashcardSetNotFound e ) {
91
94
JOptionPane .showMessageDialog (this , e .getMessage ());
0 commit comments