Skip to content

Commit fbd47f9

Browse files
committed
changed Deletion Screen to display the name of the flashcard set to be deleted
1 parent 5555b11 commit fbd47f9

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/main/java/MainPage/HomePage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public HomePage(UserLoginResponseModel user) throws IOException {
8888
else {
8989
this.add(new ListOfFlashcardSetsDataPanel(idsToFlashcardSetData, gateway, user));
9090
}
91-
this.setSize(1000, 1000);
91+
this.setSize(1000, 800);
9292
this.setVisible(true);
9393
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
9494
}

src/main/java/create_flashcardset_use_case/CreationScreen.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public CreationScreen(FlashcardSetController controller, UserLoginResponseModel
7676

7777
this.setVisible(true);
7878
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
79+
this.setSize(1000, 800);
7980
}
8081

8182
/**

src/main/java/delete_flashcardset_use_case/DeletionScreen.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class DeletionScreen extends JFrame implements ActionListener {
3333
* A window with a title and a JButton.
3434
*/
3535
public DeletionScreen(int flashcardSetID, DelFlashcardSetController controller, UserLoginResponseModel user) {
36+
this.user=user;
3637
this.flashcardSetID = flashcardSetID;
3738
this.controller = controller;
3839

@@ -60,6 +61,7 @@ public DeletionScreen(int flashcardSetID, DelFlashcardSetController controller,
6061

6162
this.setVisible(true);
6263
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
64+
this.setSize(1000, 800);
6365
}
6466

6567
/**
@@ -78,14 +80,15 @@ public void actionPerformed(ActionEvent evt) {
7880
// int id = Integer.parseInt(flashcardSetID.getText()); // check input is an integer
7981

8082
// Ask for confirmation
83+
String title = user.getFlashcardSets().get(flashcardSetID)[0];
84+
8185
int confirmation = JOptionPane.showConfirmDialog(this,
82-
"Delete Flashcard set #" + flashcardSetID + "?",
86+
"Delete " + title + "?",
8387
"Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
8488
if (confirmation == 0) {
8589
try {
8690
controller.delete(flashcardSetID);
87-
JOptionPane.showMessageDialog(this, "Flashcard Set #"
88-
+ flashcardSetID + " has been deleted.");
91+
JOptionPane.showMessageDialog(this, title + " has been deleted.");
8992
this.dispose(); // exit deletion screen
9093
} catch (FlashcardSetNotFound e) {
9194
JOptionPane.showMessageDialog(this, e.getMessage());

0 commit comments

Comments
 (0)