99import frameworks_and_drivers .screens .EditorMainScreen ;
1010
1111import javax .swing .*;
12+ import javax .swing .border .EmptyBorder ;
1213import java .awt .*;
1314import java .awt .event .ActionEvent ;
1415import java .awt .event .ActionListener ;
@@ -62,8 +63,8 @@ public ListOfFlashcardsDataPanel(DBGateway dbGateway, List<FlashcardDsRequestMod
6263 int numCards = flashcardData .size ();
6364 if (numCards == 0 ){
6465 JLabel label = new JLabel ("You have no Flashcards in this FlashcardSet." );
65- label .setHorizontalAlignment (SwingConstants .CENTER );
66- label .setVerticalAlignment (SwingConstants .TOP );
66+ // label.setHorizontalAlignment(SwingConstants.CENTER);
67+ // label.setVerticalAlignment(SwingConstants.TOP);
6768 JPanel labelPanel = new JPanel ();
6869 labelPanel .add (label );
6970 flashcardPanels .add (labelPanel );
@@ -76,17 +77,22 @@ public ListOfFlashcardsDataPanel(DBGateway dbGateway, List<FlashcardDsRequestMod
7677 //flashcardPanels customization
7778 int size = flashcardData .size ();
7879 int rows ;
79- if (size % 3 == 0 ){
80+ if (size == 0 ){
81+ flashcardPanels .setLayout (new GridLayout (1 , 1 ));
82+ }
83+ else if (size % 3 == 0 ){
8084 rows = size /3 ;
85+ flashcardPanels .setLayout (new GridLayout (rows , 3 ));
8186 }
8287 else {
8388 rows = size /3 + 1 ;
89+ flashcardPanels .setLayout (new GridLayout (rows , 3 ));
8490 }
85- flashcardPanels .setLayout (new GridLayout (rows , 3 ));
8691
8792 //This panel customization
8893 this .add (flashcardPanels );
89- this .setLayout (new FlowLayout ());
94+ this .setLayout (new BoxLayout (this , BoxLayout .Y_AXIS ));
95+ this .setBorder (new EmptyBorder (10 , 10 , 10 , 10 ));
9096 this .setComponentOrientation (ComponentOrientation .LEFT_TO_RIGHT );
9197 Dimension fcPSize = flashcardPanels .getPreferredSize ();
9298 this .setPreferredSize (new Dimension (fcPSize .width , fcPSize .height + 100 ));
0 commit comments