9
9
import frameworks_and_drivers .screens .EditorMainScreen ;
10
10
11
11
import javax .swing .*;
12
+ import javax .swing .border .EmptyBorder ;
12
13
import java .awt .*;
13
14
import java .awt .event .ActionEvent ;
14
15
import java .awt .event .ActionListener ;
@@ -62,8 +63,8 @@ public ListOfFlashcardsDataPanel(DBGateway dbGateway, List<FlashcardDsRequestMod
62
63
int numCards = flashcardData .size ();
63
64
if (numCards == 0 ){
64
65
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);
67
68
JPanel labelPanel = new JPanel ();
68
69
labelPanel .add (label );
69
70
flashcardPanels .add (labelPanel );
@@ -76,17 +77,22 @@ public ListOfFlashcardsDataPanel(DBGateway dbGateway, List<FlashcardDsRequestMod
76
77
//flashcardPanels customization
77
78
int size = flashcardData .size ();
78
79
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 ){
80
84
rows = size /3 ;
85
+ flashcardPanels .setLayout (new GridLayout (rows , 3 ));
81
86
}
82
87
else {
83
88
rows = size /3 + 1 ;
89
+ flashcardPanels .setLayout (new GridLayout (rows , 3 ));
84
90
}
85
- flashcardPanels .setLayout (new GridLayout (rows , 3 ));
86
91
87
92
//This panel customization
88
93
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 ));
90
96
this .setComponentOrientation (ComponentOrientation .LEFT_TO_RIGHT );
91
97
Dimension fcPSize = flashcardPanels .getPreferredSize ();
92
98
this .setPreferredSize (new Dimension (fcPSize .width , fcPSize .height + 100 ));
0 commit comments